What is the method for setting default values in MySQL?
To set a default value in MySQL, you can use the DEFAULT keyword after defining a field when creating a table. For example:
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(50),
department VARCHAR(50) DEFAULT 'IT'
);
In the given example, the default value for the department field has been set to ‘IT’. When inserting data, if the value for department is not specified, it will automatically default to ‘IT’.