Studied by 3 people

5.0(2)

get a hint

hint

All topics covered in Y9 computer science: databases, python, logic gates

1

Table

a collection of related data sorted in an organized way. Made up of fields and records

New cards

2

Record

all of the data relating to one instance of the table, represented by a row e.g. Sophia Austin

(donāt say that it is a row)

New cards

3

Field

an attribute which all records have in common, represented by a column e.g. date of birth

(donāt say it is a column)

New cards

4

Query

a request for information - a way to access information from a database

New cards

5

Primary key

a special field that stores a unique value (an ID) for each record

New cards

6

CREATE TABLE statement line 1

` CREATE TABLE table_name (`

āCREATE TABLEā and the table name, then open brackets

New cards

7

CREATE TABLE statement lines for fields

` text_field_name VARCHAR(30),`

text_field_name VARCHAR(30),

integer_field_name INT,

decimal_field_name FLOAT,

true_or_false_field_name BOOLEAN

(indented)

Name of your first field (column), and after it what type of data youāll be entering in it, e.g. text or numbers. For a text field you need to say how many characters it should allow as maximum. You put this number in brackets

Repeat for all the fields in the table

New cards

8

CREATE TABLE statement last line

` );`

This closes off the list

New cards

9

INSERT INTO statement first line

`INSERT INTO table_name`

āINSERT INTOā and then your table name

New cards

10

INSERT INTO statement second line

`VALUES `

New cards

11

INSERT INTO statement lines for values

`("Text 1",44,55,33,1),`

("Text 2",77,11,99,0),

("Text 3",29,100,21,8)

write a list of values to put into your table, each line is one record (row), and each field is separated by commas

quotes around any text data

New cards

12

INSERT INTO statement last line

`;`

New cards

13

SELECT FROM statement first line

`SELECT * FROM table_name;`

āSELECT * FROMā and then your table name and a ;

New cards

14

`SELECT Firstname,Email FROM table4`

What will this give you

All the firstnames and emails from table4

New cards

15

`SELECT table4.Firstname, table4.email`

What will this give you

All the firstnames and emails from table4

This is just another way of doing it, specifying each time which table you want it from instead of once at the start

New cards

16

`SELECT Firstname FROM table_name WHERE surname="abe";`

What will this give you

will give you all the firstnames in the table that have surnames containing āabeā, but not the surname

if you want it to display that you have to put it after a comma next to the firstname

New cards

17

function of => (SQL)

greater than or equal to

New cards

18

function of <= (SQL)

less than or equal to

New cards

19

function of <> (SQL)

not equal to

New cards

20

SQL: VARCHAR data type

a string of variable length (can contain letters, numbers and special characters). After it you put the maximum character length in brackets

New cards

21

SQL: INTEGER (aka INT) data type

a number

New cards

22

SQL: DECIMAL data type

an exact number with a fixed amount of digits and a fixed amount of digits after the decimal point, written as DECIMAL(*digits*, *digits after decimal point*)

New cards

23

SQL: BOOLEAN (aka BOOL) data type

true or false, 0 is false and anything else it true

New cards

24

Variable

a named memory location, used to store a value while the program is running. The value can change whilst the program runs

New cards

25

Operator

a symbol that takes one or more values and yields another value e.g. addition

New cards

26

Python: string data type

text

New cards

27

Python: integer (int) data type

number(s)

New cards

28

Python: float data type

a decimal

New cards

29

Python: boolean data type

true or false

1 = true

0 = false

New cards

30

* maths operator (python)

multiplication

New cards

31

** maths operator (python)

to the power of

New cards

32

// maths operator (python)

division, rounds the result down to the nearest whole number

New cards

33

% maths operator (python)

gives you the remainder of the first number divided by the second

New cards

34

== operator (python)

equal (not with numbers)

New cards

35

!= operator (python)

ā (not equal to)

New cards

36

NOT gate

gives the opposite of what was put into it

New cards

37

AND gate

needs both inputs to be 1 to have an output of 1, anything else will give 0

New cards

38

OR gate

Will give 1 if either or both imputs are 1, will give 0 if both are 0

New cards

39

Definite iteration

when a code is repeated a specific number of times (for loop)

New cards

40

Indefinite iteration

when a code is repeated until a condition is met/no longer met

New cards

41

Iterating over a list

printing every item in that list

New cards

42

Range function (python)

prints every number in the range you specified (not including the number that you put, including 0)

New cards