In SQL, the DEFAULT keyword is used to specify a default value for a column when a new record is inserted into a table, and the value for that column is not provided in the INSERT statement.
CREATE TABLE table_name ( column1 datatype DEFAULT default_value, column2 datatype DEFAULT default_value, );
Note: "column1", "column2", etc., are the column names, datatype is the data type of the column, and default_value is the default value assigned to the column.
CREATE TABLE products ( product_id INT PRIMARY KEY, product_name VARCHAR(50), product_category VARCHAR(50), price INT DEFAULT 300, product_added_date DATE DEFAULT CURRENT_DATE );
Note: the `product_added_date` column will default to the current date if no value is provided during an INSERT statement, and the `price` column will default to 300.
INSERT INTO products (product_id, product_name, category) VALUES (pro1, 'iPad', 'GADGETS');
UPDATE products SET price = DEFAULT WHERE product_id = 'pro1';
This will set the`price` column back to its default value for the specified record.