Flashcards
SQL - OCR Computer Science A Level
Flashcards do conjunto (10)
- 1What is SQL?> Structured Query Language
> Declaritave language used for updating tables in a relational database
> Uses statements to make, query, and modify databases - 2What do the Following Commands do? > SELECT > FROM > WHERE > ORDER BY> SELECT - lists the fields to be displayed
> FROM - lists the table(s) where data will be read from
> WHERE - lists data that matches the criteria
> ORDER BY - orders the results (default is ascending order) - 3How does the LIKE Command Work?> Condition that finds values with a wildcard
> LIKE "a%" finds values that begin with a
> LIKE "%a" finds values that end with a
> LIKE "%a%" finds values with a in any position
> LIKE "_a%" finds values with a in second position (more underscores = higher position)
> LIKE "a%b" finds values that begin with a and and with b - 4What does the JOIN Command do?> Combines rows from two or more tables, based on a common field between them
- 5How does the CREATE TABLE Command Work?CREATE TABLE table_name
(
Attribute1 DATA_TYPE, PRIMARY KEY
Attribute2 DATA_TYPE
etc.
)
For linked tables:
FOREIGN KEY Attribute3 REFERENCES OtherTable(Attribute3) - 6What Data Types can be used when Creating a Table?> CHAR(n) - string of fixed length n
> VARCHAR(n) - string of variable length, max n
> BOOLEAN - true or false, i mean you should know that one
> INTEGER / INT - ... an integer, what did you expect?
> FLOAT - a decimal (real) number
> DATE - a... a date. y'know, day, month year
> TIME - like hours, minutes, and seconds... it's pretty self explanatory
> CURRENCY - le cash money - 7How does the ALTER TABLE Command Work?> Used to add, delete, or modify columns
> ALTER TABLE table_name ADD attribute_name - adds the specified attribute
> ALTER TABLE table_name DROP COLUMN attribute_name - removes the specified attribute
> ALTER TABLE table_name MODIFY COLUMN attribute_name DATA_TYPE - changes the data type of the attribute - 8How does the INSERT INTO Command Work?> Used to insert a new record into a table
INSERT INTO table_name (column1, column2...)
VALUES (value1, value2...)
> If attributes are unknown, do not list them in the columns or values - 9How does the UPDATE Command Work?> Used to update a record in a database table
UPDATE table_name
SET column1 = value1, etc.
WHERE attribute = value - 10How does the DELETE Command Work?> it deletes a record. who'd've thunk it?
DELETE FROM table_name
WHERE attribute = value
Informações
- Descrição
- A level Computer Science (Databases and SQL) FlashCards sobre SQL - OCR Computer Science A Level, criado por Malachy Moran-Tun em 18-05-2022.
- Criado por
- Malachy Moran-Tun
- Visualizações
- 2
- Histórico
-
- Criado por Malachy Moran-Tun · 18 mai 2022
- Copiado por Malachy Moran-Tun · 18 mai 2022
- Avaliação