4 - 18 Introduction to SQL Flashcards
What does SQL stand for?
Structured Query Language
What type of language is SQL?
SQL is a declarative language
What is SQL used for?
SQL is used for querying and updating tables in a relational database. It can also be used to create tables.
Give the basic syntax for the SELECT statement.
SELECT list the fields to be displayed
FROM list the table or tables the data will come from
WHERE list the search criteria
ORDER BY list the fields that the results are to be sorted on (default is Ascending order)
Give the meaning, example and any notes that may be included with the operator symbol being ‘=’
Equal to e.g. CDTitle = “Autumn”. Different implementations use single or double quotes
Give the meaning, example and any notes that may be included with the operator symbol being ‘>’
Greater than, eg.g. DatePublished > #01/01/2015#. The date is enclosed in quote marks or, in Access, # symbols
Give the meaning, example and any notes that may be included with the operator symbol being ‘
Less than, e.g. Date Published < #01/01/2015#
Give the meaning, example and any notes that may be included with the operator symbol being ‘!=’
Not equal to, e.g. RecordCompany != “ABC”
Give the meaning, example and any notes that may be included with the operator symbol being ‘>=’
Greater than or equal to, e.g. DatePublished >= #01/01/2015#
Give the meaning, example and any notes that may be included with the operator symbol being ‘<=’
Less than or equal to, e.g. DatePublished <= #01/01/2015#
Give the meaning, example and any notes that may be included with the operator symbol being ‘IN’
Equal to the value within a set o values, RecordCompany IN (“ABC”, “DEF”)
Give the meaning, example and any notes that may be included with the operator symbol being ‘LIKE’
Similar to, e.g. CDTitle LIKE “S%”. Finds shadows (wildcard operator varies and can be *)
Give the meaning, example and any notes that may be included with the operator symbol being ‘BETWEEN… AND’
Within a range, including the two values which define the limits, e.g. DatePublished BETWEEN #01/01/2015# AND #31/12/2015#
Give the meaning, example and any notes that may be included with the operator symbol being ‘IS NULL’
Field does not contain a value, e.g. RecordCompany is NULL
Give the meaning, example and any notes that may be included with the operator symbol being ‘AND’
Both expressions must be true for the entire expression to be judged true, e.g. DatePubished > #01/01/2015# AND RecordCompany = “ABC”