GCSE AQA Computer Science : (Paper 2) SQL (Structured Query Language)

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

10 Terms

1
New cards

what is SQL used for?

used to retrieve data from relational databases using certain commands

2
New cards

how to write a SELECT command?

SELECT {field you want to show}

SELECT * {selects all fields in a table}

this retrieves a record. other commands can then be carried out on the record without affecting the whole database

3
New cards

how to use FROM in a SELECT command?

SELECT {field you want to show} FROM {table you want to choose}

example - SELECT firstName FROM student

this identifies the table where the data come from

4
New cards

how to use WHERE in a SELECT command?

SELECT {field you want to show} FROM {table you want to choose} WHERE {search criteria}

search criteria could be Gender = 'Male' or Age = 11

this limits retrieval of those record that match a set of criteria

5
New cards

how to use INSERT command?

INSERT INTO {table} VALUES {values that need to be entered as a record}

this is used to insert new records in a table

6
New cards

how to use UPDATE command?

UPDATE {table} SET {field = 'what you want to set it to'} WHERE {primary key condition}

example of primary key condition -> WHERE StudentID = 2

this changes the data in one or more records in a table

7
New cards

how to use DELETE command?

DELETE FROM {table} WHERE {primary key condition}

example of primary key condition -> WHERE StudentID = 2

8
New cards

how to use ORDER BY command?

SELECT {fields you want to show} FROM {table you want to order} WHERE {condition} ORDER BY {field} ASC/DESC or a field

this is used to sort the result set in ascending or descending order

9
New cards

how to state a join in a relational database?

{table1.field/primary key} = {table2.field/foreign key}

example -> student.studentID = volunteer.studentID

10
New cards

how to structure a long answer SQL query in exams?

SELECT (fields separated by commas)

FROM (tables separated by commas)

WHERE (relational database join and or condition)

ORDER BY (fields) ASC/DESC