SQL Flashcards
What is a primary key?
Unique identifier in each row of the table
What is an entity?
Any person or thing in the database
What is a foreign key?
A foreign key is a field which is a primary key in a linked table
What is data redundancy?
Waste of data
What is data inconsistency ?
When the same data exists in different formats in multiple tables
What is Structured Query Language (SQL) ?
A language used for enquiring and updating database tables in a relational database.
SELECT…FROM…WHERE meaning
SELECT list of fields to be displayed
FROM list the table or tables where the data will come from
WHERE list of search criteria
ORDER BY list the fields that the results are to be sorted on (default is Ascending)
What are the 4 types of SQL?
Search, Update, Insert and Delete
How does an Insert SQL work?
INSERT INTO tableName(column1, column 2)
VALUES (value1, value2)
How does an Update SQL work?
UPDATE tableName
SET column1 = value1, column2 = value2
WHERE column = value
How does delete SQL work?
DELETE FROM tableName
WHERE column = value
Which SQL statement is used to return only different values?
SELECT DISTINCT
With SQL, how can you insert “Olsen” as the “LastName” in the “Persons” table?
INSERT INTO Persons (LastName) VALUES (‘Olsen’)
Which operator is used to select values within a range?
BETWEEN
Which operator is used to search for a specified pattern in a column?
LIKE