Write a command to insert at least 5 rows in the above created table Sales
Answers
Solution
Use the INSERT statement with the VALUES clause to insert one row at a time:
insert into dept (deptno,dname,loc)
values (50,'PROGRAMMING','BALTIMORE')
For DB2 and MySQL you have the option of inserting one row at a time or multiple rows at a time by including multiple VALUES lists:
/* multi row insert */
insert into dept (deptno,dname,loc)
values (1,'A','B'),
(2,'B','C')
Discussion
The INSERT statement allows you to create new rows in database tables. The syntax for inserting a single row is consistent across all database brands.
As a shortcut, you can omit the column list in an INSERT statement:
insert into dept
values (50,'PROGRAMMING','BALTIMORE')
However, if you do not list your target columns, you must insert into all of the columns in the table, and be mindful of the order of the values in the VALUES list; you must supply values in the same order in which the database displays columns in response to a SELECT * query.