Xem mẫu

Instructor Inputs Session Overview This session includes Chapter 5 of the Student Guide. Slide 1 Querying and Managing Data Using SQL Server 2005 Objectives In this session, you will learn to: Manipulate data by using Data Manipulation Language statements Manipulate the Extensible Markup Language data Ver. 1.0 Session 7 Slide 1 of 20 Begin the session by sharing the session objectives with the students. Slide 2 Querying and Managing Data Using SQL Server 2005 Storing Data in a Table Data can be stored in a table: By adding data in the form of rows By using the INSERT statement Syntax: INSERT [INTO] {table_name} [(column_list)] VALUES {DEFAULT | values_list | select_statement} Let’s see how… Ver. 1.0 Session 7 Slide 2 of 20 ¤NIIT Instructor Inputs 7.3 In this topic, you will teach the students how to store data in a table by using the INSERT statement. You need to explain the various ways in which data can be inserted. For this, you can use the examples given in the Student Guide. Slide 3 Querying and Managing Data Using SQL Server 2005 Storing Data in a Table (Contd.) Data can be inserted in a table in the following ways: By inserting partial data By inserting data in related tables By copying data from an existing table into a new table Let’s see how… Ver. 1.0 Session 7 Slide 3 of 20 Tell the students that while inserting rows, it is a good practice to mention the column list. Emphasize on the following guidelines to insert data: ④ Values for columns containing the char and varchar data types should be enclosed in single quotes. ④ While inserting values into a column that has a default constraint defined on it, if you want the default value to be inserted for that column, you can use the DEFAULT keyword. ④ While entering data, the column-list needs to be specified when the data being entered is not in the order of the columns in the table or when the data is not being entered for all the columns. ④ The SQL Server will automatically generate values for an identity column. It is not a good practice to insert values for the column. ④ While inserting partial data, the columns for which data is not being inserted should support NULL or default values. ④ You cannot insert rows into two tables with a single INSERT statement. To demonstrate the example to insert data in the Address table, you need to create the Address table in the database. For this, you can use the CreateAddressTable.sql given in the DataFiles_for_Faculty\Chapter 05\01_Instep Demo folder in the TIRM CD. 7.4 Instructor Inputs ¤NIIT Slide 4 Querying and Managing Data Using SQL Server 2005 Just a minute Which statement allows you to insert data in a table? Answer: INSERT INTO Ver. 1.0 Session 7 Slide 4 of 20 Reiterate the concepts taught earlier by asking the given question. Slide 5 Querying and Managing Data Using SQL Server 2005 Just a minute Which statement allows you to copy contents of one table into another table? Answer: SELECT INTO Ver. 1.0 Session 7 Slide 5 of 20 Reiterate the concepts taught earlier by asking the given question. ¤NIIT Instructor Inputs 7.5 ... - tailieumienphi.vn
nguon tai.lieu . vn