SQL Statements Flashcards
What is the INSERT Statement?
May insert a single, or many rows
How would you insert a single row?
Column names are optional, if column names are not specified, all columns must have values.
How would you insert multiple rows?
What is the DELETE Statement?
May delete a single or many (all) rows. The WHERE clause is optional. If not specified all rows will be deleted without warning.
How would you delete a single row?
How would you delete multiple rows?
How would you delete all rows?
What is the UPDATE Statement?
May update a single or many(all) rows. Where clause is optional. If not specified all rows will be updated without warning.
How would you update a single row?
The WHERE clause uses primary key to locate one record
How would you update multiple rows?
WHERE clause located many records
What is the GO Statement?
When a “batch” of statements have been executed, the end of the batch can be signified by a GO statement. The GO statement is usually optional, but can be required in certain circumstances. Some CREATE statements require that they are the first statement in a batch.
How would you set the date format in an SQL script?
SET DATEFORMAT ymd
Sets the date format to YYYY-MM-
What is a JOIN?
Frequently it is useful to join the data from multiple tables together.
SELECT column(s)
FROM firsttable
JOIN secondtable
ON firsttable.column = secondtable.colum
What are the different join types?
Inner join (default), left outer join, right outer join, full outer join, cross join.
How would you do an inner join?