Data Manipulation Language Flashcards
What does SELECT INTO do?
Creates a new table based on the result set of a SELECT statement
What does the INTO keyword do?
Identifies the name of the table to create
Where do you place the INTO keyword?
The INTO keyword is placed after the last column name in the SELECT clause and before the FROM clause
How long do temp tables last?
Temp tables are temporary tables that only last for the duration of your SQL Server session
What’s the syntax for a local temp table vs a global temp table
Local temp tables are prefixed with a hash tag (#), global temp tables are prefixed with two hashtags (##)
What does the INSERT statement do?
The INSERT statement is used to add one or more rows of
data into an existing table. The data can come from
Where does the INSERT statement pull data from?
From an external source such as a text file or
Excel spreadsheet
What is a ways to enter data into SQL?
Enter data manually using the INSERT VALUES clause
INSERT INTO Employee (EmployeeID, LastName, FirstName, Email)
VALUES (101, ‘Doe’, ‘John’, ‘john.doe@example.com’);
What is INSERT INTO … SELECT use for?
it is used for inserting rows based on the result of a query from another table.
INSERT INTO Customer_temp (CustomerID, LastName, FirstName, Email)
SELECT EmployeeID + 200, LastName, FirstName, Email
FROM Employee
WHERE HireDate > ‘2020-01-01’;
How do you remove tables from a database?
Drop Table
How do you modify existing records in a table?
UPDATE statement
Which two keywords use the WHERE clause to filter results?
The UPDATE and DELETE keywords