xxxxxxxxxx
insert into toys (toy_id, colour) values ( 3, 'red' );
select * from toys
where toy_id = 3;
xxxxxxxxxx
--sql insert quest example
INSERT INTO table_name (column1, column2, column3, )
VALUES (value1, value2, value3, );
xxxxxxxxxx
INSERT INTO Campus (Campus_Name, Address, Zip, Phone_No)
VALUES
('Nairobi Campus', '123 Moi Avenue, Nairobi', '00100', 0712345678),
('Mombasa Campus', '456 Kilindini Road, Mombasa', '80100', 0723456789),
('Eldoret Campus', '789 Main Street, Eldoret', '30100', 0734567890),
('Kisumu Campus', '987 Lake Road, Kisumu', '40100', 0745678901),
('Nakuru Campus', '654 Kenyatta Avenue, Nakuru', '20100', 0756789012);
xxxxxxxxxx
INSERT INTO Customers(customer_id, first_name, last_name, age, country)
VALUES
(5, 'Harry', 'Potter', 31, 'USA');
xxxxxxxxxx
INSERT INTO tableName
VALUES (‘anydata’, ‘anydata’, ‘anydata’, ‘anydata’, NULL,
NULL);
xxxxxxxxxx
-- if you want to insert values in all column
-- values must be assigned to that column
INSERT INTO table_name
VALUES
(value1, value2, value3, );
-- ^ ^ ^ ^
-- (column1, column2, column3, )
-- the same arrangement
xxxxxxxxxx
Add new rows to a table.
Example: Adds a new vehicle.
INSERT INTO cars (make, model, mileage, year)
VALUES ('Audi', 'A3', 30000, 2016);