Fichas
SQL
Fichas del conjunto (12)
- 1Structured Query Language (SQL)Declarative language
Used for querying and modifying database tables - 2SELECT FROM WHERE SELECT FROM WHEREExtract specific fields (or every field if * is used) with specific properties from the specified table(s)
- 3Conditions for SELECT= :: Equal to
> :: Greater than
< :: Less than
!= :: Not equal to
>= :: Greater than or equal to
<= :: Less than or equal to
IN :: Value within a given set
LIKE :: Similar to
BETWEEN AND :: Takes one of a range of values
IS NULL :: Empty field
AND, OR, NOT :: Logical operators - 4JOIN ONAnother way of combining selections from multiple tables
- 5CREATE TABLE [IF NOT EXISTS] ( ... )Creates a new table with the specified fields
IF NOT EXISTS is optional, and will only create a new table if a table with the provided name doesn't already exist within the database - 6Datatypes for CREATE TABLE1. CHAR(n) - Character string of fixed length n
2. VARCHAR(n) - Variable-length character string, max length n
3. BOOLEAN - takes TRUE of FALSE in capitals here
4. INTEGER, INT
5. FLOAT
6. DATE - Day, month, year
7. TIME - Hour, minute, second
8. CURRENCY - Formats to region - 7ALTER TABLE [ADD] [DROP COLUMN] [MODIFY COLUMN]Changes structure of an existing table
ADD - adds a new column
DROP COLUMN - deletes column
MODIFY COLUMN - edits an existing column - 8Defining keys in SQLEnd of CREATE TABLE statement
Add FOREIGN KEY REFERENCES for foreign keys
Use PRIMARY KEY (, , ..., ) for creating primary keys with 'n' parts - 9INSERT INTO (, ...) VALUES (, ...)Adds a new record to the database
- 10UPDATE SET = WHERE =Updates a record in the database
- 11DELETE FROM WHEREDeletes records satisfying a certain condition
- 12CRUD methodsPrepared statements for security
Create - Create new tables or records in the database
Read - Get values from the database
Update - Alter tables or records in the database
Delete - Remove tables or records from the database
Información
- Descripción
- A level (Topic 4 - Exchanging Data) OCR A level Computer Science Fichas sobre SQL, creado por James Norman el 28/01/2020.
- Creado por
- James Norman
- Visitas
- 0
- Valoración