1 00:00:00,000 --> 00:00:03,410 Hello, and welcome to the INSERT statement. 2 00:00:03,410 --> 00:00:07,515 In this video, we will learn about populating a relational database table. 3 00:00:07,515 --> 00:00:11,240 At the end of this video, you'll be able to identify the syntax of 4 00:00:11,240 --> 00:00:15,865 the INSERT statement and explain two methods to add rows to a table. 5 00:00:15,865 --> 00:00:17,655 After table is created, 6 00:00:17,655 --> 00:00:19,935 the table needs to be populated with data. 7 00:00:19,935 --> 00:00:21,965 To insert data into a table, 8 00:00:21,965 --> 00:00:23,840 we use the INSERT statement. 9 00:00:23,840 --> 00:00:27,330 The INSERT statement is used to add new rows to a table. 10 00:00:27,330 --> 00:00:31,470 The INSERT statement is one of the data manipulation language statements. 11 00:00:31,470 --> 00:00:37,955 Data manipulation language statements or DML statements are used to read and modify data. 12 00:00:37,955 --> 00:00:40,635 Based on the author entity example, 13 00:00:40,635 --> 00:00:44,190 we created the table using the entity name author, 14 00:00:44,190 --> 00:00:47,705 and the entity attributes as the columns of the table. 15 00:00:47,705 --> 00:00:52,765 Now we will add the data to the author table by adding rows to the table. 16 00:00:52,765 --> 00:00:55,525 To add the data to the author table, 17 00:00:55,525 --> 00:00:57,805 we use the INSERT statement. 18 00:00:57,805 --> 00:01:01,005 The syntax of the INSERT statement looks like this, 19 00:01:01,005 --> 00:01:06,415 insert into table name, column name, values. 20 00:01:06,415 --> 00:01:10,385 In this statement, table name identifies the table, 21 00:01:10,385 --> 00:01:14,490 the column name list identifies each column in the table, 22 00:01:14,490 --> 00:01:20,140 and the values clause specifies the data values to be added to the columns in the table. 23 00:01:20,140 --> 00:01:23,260 To add a row with the data for Raul Chong, 24 00:01:23,260 --> 00:01:27,350 we insert a row with an author underscore ID of A one, 25 00:01:27,350 --> 00:01:29,165 the last name is Chong, 26 00:01:29,165 --> 00:01:31,085 the first name as Raul, 27 00:01:31,085 --> 00:01:34,755 the email as RFC@IBM.com, 28 00:01:34,755 --> 00:01:36,479 the city is Toronto, 29 00:01:36,479 --> 00:01:38,880 and the country as CA for Canada. 30 00:01:38,880 --> 00:01:41,240 The author table has six columns, 31 00:01:41,240 --> 00:01:46,000 so the INSERT statement lists the six column names separated by commas, 32 00:01:46,000 --> 00:01:50,865 followed by a value for each of the columns also separated by commas. 33 00:01:50,865 --> 00:01:55,065 It is important that the number of values provided in the values clause 34 00:01:55,065 --> 00:01:59,260 is equal to the number of column names specified in the column name list. 35 00:01:59,260 --> 00:02:02,180 This ensures that each column has a value. 36 00:02:02,180 --> 00:02:06,105 Tables do not need to be populated one row at a time, 37 00:02:06,105 --> 00:02:11,395 multiple rows can be inserted by specifying each row in the values clause. 38 00:02:11,395 --> 00:02:13,030 In the values clause, 39 00:02:13,030 --> 00:02:15,645 each row is separated by a comma. 40 00:02:15,645 --> 00:02:20,390 For example, in this INSERT statement we are inserting two rows, 41 00:02:20,390 --> 00:02:24,050 one for Raul Chong and one for Rav Ahuja. 42 00:02:24,050 --> 00:02:27,670 Now you can identify the syntax of the INSERT statement, 43 00:02:27,670 --> 00:02:30,845 and explain the two methods to add rows to a table. 44 00:02:30,845 --> 00:02:33,785 One row at a time or multiple rows. 45 00:02:33,785 --> 00:02:36,550 Thanks for watching this video.