Mysql | Insert
MySQL
CREATE TABLE Customers
(
ID int,
Age int,
FirstName varchar(20),
LastName varchar(20)
);
-- Creating the Products table
CREATE TABLE Products01
(
ID int,
ProductName varchar(30) NOT NULL,
Manufacturer varchar(20) NOT NULL,
Price decimal NOT NULL,
ProductCount int DEFAULT 0
);
CREATE TABLE Smartphones
(
ID int,
ProductName varchar(30) NOT NULL,
Manufacturer varchar(20) NOT NULL,
Price decimal NOT NULL,
ProductCount int DEFAULT 0
);
- insert specified values
- insert values to all columns
- insert the default value
MySQL
INSERT INTO Products01(ProductName, Manufacturer, Price, ProductCount)
VALUES ('Nokia 9', 'HD Global', '41000', DEFAULT);
MySQL
INSERT INTO Products01 (ProductName, Manufacturer, Price, ProductCount)
VALUES ('Nokia 9', 'HD Global', '41000', NULL);
- insert a specific value
- insert data from another table