SQL - Basics
- SELECT - extracts data from a database
- UPDATE - updates data in a database
- DELETE FROM - deletes data from a database
- INSERT INTO - inserts new data into a database
- CREATE DATABASE - creates a new database
- ALTER DATABASE - modifies a database
- CREATE TABLE - creates a new table
- ALTER TABLE - modifies a table
- DROP TABLE - deletes a table
- CREATE INDEX - creates an index (search key)
- DROP INDEX - deletes an index
NOT
ORDER BY
INSERT INTO
UPDATE
DELETE FROM
COUNT
Return the number of records that have the Price value set to 18.
LIKE
Select all records where the value of the City column:
- starts with the letter "a":
- ends with the letter "a":
- contains the letter "a":
- starts with letter "a" and ends with the letter "b":
- does NOT start with the letter "a":
- second letter of City is an "a":
- select all records where the first letter of the City is an "a" or a "c" or an "s":
- select all records where the first letter of the City starts with anything from an "a" to an "f".
- select all records where the first letter of the City is NOT an "a" or a "c" or an "f".
IN
Use the IN operator to select all the records where Country is either "Norway" or "France".
Use the IN operator to select all the records where Country is NOT "Norway" and NOT "France".
Use the BETWEEN operator to select all the records where the value of the Price column is between 10 and 20.
Use the BETWEEN operator to select all the records where the value of the Price column is NOT between 10 and 20.
Use the BETWEEN operator to select all the records where the value of the ProductName column is alphabetically between 'Geitost' and 'Pavlova'.
Select all the records from the Customers table plus all the matches in the Orders table.
GROUP BY
List the number of customers in each country.
List the number of customers in each country, ordered by the country with the most customers first.
Database
Delete a database named testDB.
Delete a table called Persons
Delete all data inside a table
Add a column of type DATE called Birthday.
Delete the column Birthday from the Persons table.