Insert Statement Adds one or more rows to a table Inserting into a table

Insert statement adds one or more rows to a table

This preview shows page 25 - 35 out of 42 pages.

Insert Statement Adds one or more rows to a table Inserting into a table Keywords : INSERT , INTO , VALUES Single Quote required for text INSERT INTO Customers VALUES (1, 'Verma', 'Sameer', '2017-01- 18’ , '(415) 338 - 7016’ , '[email protected]'); Inserting a record that has some null attributes requires identifying the fields that actually get data We list the fields An error from your textbook
Image of page 25
Insert Statement Inserting from another table We will see SELECT, *, FROM, WHERE in a sec
Image of page 26
Delete Statement Removes rows from a table Delete certain rows DELETE FROM CUSTOMERS WHERE CUSTOMERID = 1; Delete all rows DELETE FROM CUSTOMER; Keywords : DELETE FROM (table name), WHERE
Image of page 27
Update Statement Modifies data in existing rows Keywords : UPDATE , SET , WHERE UPDATE Customers2 SET FirstName = 'John’, LastName = 'Doe' WHERE CustomerID = 1 ;
Image of page 28
Agenda SQL Environment Table Operations: Create, Alter, Drop Data Operations: Insert, Update, Delete Queries : SELECT
Image of page 29
SELECT Statement Used for queries on single or multiple tables Clauses of the SELECT statement: SELECT List the columns (and expressions) to be returned from the query FROM Indicate the table(s) or view(s) from which data will be obtained WHERE Indicate the conditions under which a row will be included in the result GROUP BY Indicate categorization of results HAVING Indicate the conditions under which a category (group) will be included ORDER BY Sorts the result according to specified criteria Figure 6-2 General syntax of the SELECT statement used in DML
Image of page 30