SQL Flashcards
(22 cards)
What does SQL stand for?
“Structured Query Language”
What can SQL do?
SQL can retrieve, insert, update, and delete records in a database via executing queries against a database. You can also create new databases, as well as tables, stores procedures, and views in the database.
What are the five major commands in SQL?
SELECT, UPDATE, DELETE, INSERT, and WHERE.
How would you select all entries in the table titled “Customers”?
SELECT * FROM Customers;
What is another name for a “record”?
A “row”. Which is a horizontal entity in a table.
What is a column?
A vertical entity in a table that contains all information associated with a specific field in a table.
Are SQL keywords case sensitive?
No.
Are semicolons required after SQL statements?
Some versions of SQL require it, however it’s standard practice to use a semicolon to separate your statements.
What is the SELECT keyword used for?
Extracting data from a database.
What is the UPDATE keyword used for?
Updating data in a database.
What is the DELETE keyword used for?
Deleting data from a database.
What is the INSERT INTO keyword used for?
Inserting new data into a dabase.
What is the ALTER keyword used for?
Modifying existing tables/databses.
What is the DROP keyword user for?
Deleting existing tables/databases.
How would you select only the “City” row from the “Customers” database.
SELECT City FROM Customers;
Fill in the blank: ______ City, CustomerName FROM Customers;
SELECT City, CustomerName FROM Customers;
What keyword would you use to select ONLY distinct items from a database?
SELECT DISTINCT columnx, columny FROM table_name;
What is the WHERE keyword used for?
It is used to extract records under a specific condition.
Write a SQL statement that will select all from the Customers database where the country equals “Mexico”.
SELECT * FROM Customers
Where Country = ‘Mexico’;
What operators can be used with the WHERE clause?
AND, and OR.
Write a statement using AND, and OR in a WHERE clause.
SELECT column1
FROM table_name
WHERE condition1 AND condition2
Write a statement using AND in a WHERE clause.
SELECT column1
FROM table_name
WHERE condition1 AND condition2