SQL with Oracle 10g XE - Using INSERT to Add Data to a Table

preview_player
Показать описание
In this video I use the INSERT command to add an entire record into a table. When using the command you must also use the keyword VALUES. If you want to enter a null value (one that has no value) for a field you can use the keyword NULL. Be sure to put single quotes around data types that are not numbers. Values need to be entered in the order the fields appear in the table.
The commands I used are:
INSERT INTO BOOKS
VALUES
(1,'140231862','9780140231861','The Winter King: A Novel of Arthur','Fiction','14.99','P',1996,1,2)
INSERT INTO BOOKS
VALUES
('2','140232478','9780140232479','Enemy of God: A Novel of Arthor','Fiction',14.99,'P','1997',1,2);
INSERT INTO BOOKS
VALUES
('3','140232877','9780140232875','Excalibur: A Novel of Arthor','Fiction',14.99,'P','1998',1,2);
INSERT INTO BOOKS
VALUES
('4','6513840','9780006513841','Harlequin: Grail Quest','Fiction',19.99,'P','2001',1,1);
INSERT INTO BOOKS
VALUES
('5','6513859','9780006513858','Vagabond: Grail Quest','Fiction',19.99,'P','2003',1,1);
INSERT INTO BOOKS
VALUES
('6','7149891','9780007149896','Heretic: Grail Quest','Fiction',19.99,'P','2004',1,1);
INSERT INTO BOOKS
VALUES
('7','553103547','9780553103540','A Game of Thrones','Fiction',13.99,'H','1996',2,4);
INSERT INTO BOOKS
VALUES
('8','553801473','9780553801477','A Dance with Dragons','Fiction',13.99,'H','2010',2,5);
INSERT INTO BOOKS
VALUES
('9','055357342X','9780553573428','A Storm of Swords','Fiction',4.99,'P','2003',2,4);
INSERT INTO BOOKS
VALUES
('10','1596590424','9781596590427','50 Success Classics','Audio',17.99,NULL,NULL,3,3)
INSERT INTO AUTHOR
VALUES
(1,'Cornwell','Bernard');
INSERT INTO AUTHOR
VALUES
(2,'Martin','George');
INSERT INTO AUTHOR
VALUES
(3,'Butler','Tom');
INSERT INTO PUBLISHER
VALUES
(1,'HarperCollins Publishers Canada, Limited');
INSERT INTO PUBLISHER
VALUES
(2,'Penguin Books Canada, Limited');
INSERT INTO PUBLISHER
VALUES
(3,'Gildan Media Corp');
INSERT INTO PUBLISHER
VALUES
(4,'Bantam Dell Pub Group');
INSERT INTO PUBLISHER
VALUES
(5,'Spectra');


Рекомендации по теме
Комментарии
Автор

thank you for all your videos, you make simple and easy to grasp. i am taking classes online with ecpi university and i watch your videos to help me with these classes.
keep the good work.

BlitzBeast
Автор

I am getting error says table or view does not exist but actually rable is their already 🙄

Tbm
Автор

thanks for this -- great source for newbies...

asandl
Автор

can you tell me if i insert as:- insert into student(1, 'abc', 20, 'london') then it show error where i take name char(20)and address char(60) it is only show the error in some suggestion to solve it.

Sanjaychaudhary-xbej
Автор

How can I import a .csv excel file into created table?

KR
join shbcf.ru