#MySQL #course #tutorial 00:00:00 intro 00:02:25 DEFAULT when creating a table 00:03:26 DEFAULT for an existing table 00:05:19 example 2 00:07:56 conclusion – EXAMPLE 1 CREATE TABLE products ( product_id INT, product_name varchar(25), price DECIMAL(4, 2) DEFAULT 0 ); ALTER TABLE products ALTER price SET DEFAULT 0; INSERT INTO products (product_id, product_name) VALUES (104, “straw“), (105, “napkin“), (106, “fork“), (107, “spoon“); SELECT * FROM products; – EXAMPLE 2 CREATE TABLE transactions( transaction_id INT, amount DECIMAL(5, 2), transaction_date DATETIME DEFAULT NOW() ); SELECT * FROM transactions; INSERT INTO transactions (transaction_id, amount) VALUES (1, ); SELECT * FROM transactions; INSERT INTO transactions (transaction_id, amount) VALUES (2, ); SELECT * FROM transactions; INSERT INTO transactions (transaction_id, amount) VALUES (3, ); SELECT * FROM transactions; DROP TABLE transactions;
Hide player controls
Hide resume playing