Paper 2: Databases and SQL Flashcards
What is a Database?
A store of data, normally a mix of text and numbers that can be easily searched.
What is a Flat file Database?
A database with one table of data on one particular topic.
What is a Relational database?
A database that can contain multiple tables on different topics that can then be linked together to make searching faster and more efficient.
What does a Table represent in a database?
Data stored on one particular topic, containing rows (Records) and columns (Field Names).
What are Field Names?
The headings for the Data that is going to be stored in that column.
What is a Field in the context of a database?
An individual cell of data in the database.
What is a Record?
Data on one item in the table (A row), which can contain multiple datatypes unlike an array in programming.
What is a Primary Key?
The unique field in a record, normally an ID.
What is a Datatype?
How the data will be stored.
What is a Query?
Searching the data for specific information.
What is Information in the context of databases?
Data arranged or collected together into a useful form.
What does SQL stand for?
Structured Query Language.
What is SQL used for?
The programming language for setting up and using databases, and querying the database to find information.
What are the three main components of an SQL Query?
- SELECT
- FROM
- WHERE
What does the SELECT statement do?
Will contain the field names we wish to include in the query, separated by a comma.
What does the FROM statement specify in an SQL Query?
The table name, which will always be included in an examination question.
What is the purpose of the WHERE clause in SQL?
Contains the search criteria (What we are looking for) and is similar to an if statement in Python.
True or False: Any word data in a WHERE clause is put inside quotes.
True.
Fill in the blank: In SQL, multiple search criteria are linked together using _____ or _____.
AND, OR
Write the SQL query to display the surname and forename for all female employees who live in Birmingham.
SELECT surname, forename FROM tblEmployees WHERE Sex = “F” and City = “Birmingham”
Write the SQL query to display all fields for employees who have been employed for 2 years or more and have salaries more than £50000.
SELECT * FROM tblEmployees WHERE Years in employment >= 2 and Salary > 50000