tailieunhanh - SQL VISUAL QUICKSTART GUIDE- P35

SQL VISUAL QUICKSTART GUIDE- P35:SQL (pronounced es-kyoo-el) is the standard programming language for creating, updating, and retrieving information that is stored in databases. With SQL, you can turn your ordinary questions (“Where do our customers live?”) into statements that your database system can understand (SELECT DISTINCT city, state FROM customers;) | Chapter 10 To insert a row by using column positions Type INSERT INTO table VALUES value1 value2 . valueN table is the name of a table to insert the row into. valuel value2 . valueNis a parenthesized list of comma-separated literals or expressions that provides a value to every column in the new row. The number of values must equal the number of columns in table and the values must be listed in the same sequence as the columns in table. The DBMS inserts each value into the column that corresponds to the value s position in table. valuel is inserted into the first column of table in the new row value2 into the second column and so on. This statement adds one row to table Listing . Listing This INSERT statement adds a new row to the table authors by listing values in the same order in which the columns appear in authors. See Figure for the result. Listing INSERT INTO authors VALUES A08 Michael Polk 512-953-1231 4028 Guadalupe St Austin TX 78701 Inserting Rows with INSERT 320 Inserting Updating and Deleting Rows Listing This INSERT statement adds a new row to the table authors by listing values in the same order in which the column names appear in the column list. See Figure for the result. Listing INSERT INTO authors au_id au_fname au_lname phone address city state zip VALUES A09 Irene Bell 415-225-4689 810 Throckmorton Ave Mill Valley CA 94941 Listing You don t have to list column names in the same order in which they appear in the table. Here I ve rearranged the column names and their corresponding values. See Figure for the result. Listing INSERT INTO authors zip phone address au_lname au_fname state au_id city VALUES 60614 312-998-0020 1937 N. Clark St Weston Dianne IL A10 Chicago To insert a row by using column names Type INSERT INTO table columnl column2 . columnN VALUES value1 value2 . valueN table is the name of the table to insert the row into. columnl column2 . columnN is a parenthesized list of comma-separated names of .

TỪ KHÓA LIÊN QUAN