7. Relational databases and structured query language (SQL) Flashcards
What is a database?
an organized collection of structured information, or data, typically stored electronically in a computer system
Give 3 examples of a database:
- Classcharts
- SIMS
- NHS records
- Government records
- Library book records
- Social Media accounts
What is a relational database?
- a collection of data items with pre-defined relationships between them
- Data is typically structured across multiple tables, which can be joined together via a primary key or a foreign key.
What are the advantages of a relational database over a flat file database? (main two, but try four)
- no inconsistencies in the data
- no redundant data
- more data can be handled
- increased speed and performance
What is a flat file database?
a database that stores a single table of data inside a single file text
what is a table?
The component in which all the data is stored
what is a record?
an individual collection of all the data for one person/item (basically a row)
what are all the possible data types in a database?
- integer (for a whole number)
- real/float/decimal (for a decimal)
- char (for a fixed amount of characters of an alphanumeric string up to 8,000 characters)
- varchar (for an unfixed amount of characters of an alphanumeric string up to 8,000 characters)
- Date (date)
- Time (time)
- Date time (date and time )
- Text (alphanumeric string of up to 2GB of data)
how to write select all in SQL?
SELECT *
how to choose a specific table in SQL?
FROM specific table
how to select a particular field of a record (one box) in SQL?
WHERE fieldname = data in particular field
what are the two ways you can order data in SQL?
ascending (ORDER BY ASC)
descending (ORDER BY DESC)
Be able to use SQL to insert data into a relational database using the commands.
INSERT INTO table_name (column1, column 2 …)
VALUES (value1, value2 …)
can you do that?
Be able to use SQL to edit and delete data in a database using the commands.
UPDATE table_name
SET column1 = value1, column2
= value2 …
WHERE condition
DELETE FROM table_name WHERE condition
can you do that?