SQL Flashcards

(33 cards)

1
Q

What does SQL stand for?

A

Structured Query Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What type of language is SQL?

A

Declarative language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the four main commands in SQL?

A
  • SELECT
  • UPDATE
  • INSERT
  • DELETE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the purpose of the SELECT command in SQL?

A

Used for retrieving data from a database table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the general form of the SELECT command?

A

SELECT <attribute> FROM <table> WHERE <condition> ORDER BY <ASC/DESC></condition></attribute>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Is the ORDER BY clause mandatory in a SELECT command?

A

No, it is optional

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the purpose of the UPDATE command?

A

Used for modifying the attributes of an existing entity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the general form of the UPDATE command?

A

UPDATE <table> SET <attribute> = <value> WHERE <attribute> = <value></value></attribute></value></attribute>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of the DELETE command?

A

Used for removing entities from a database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the general form of the DELETE command?

A

DELETE FROM <table> WHERE <condition></condition>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the purpose of the INSERT command?

A

Used to add new records to an existing table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the general form of the INSERT command?

A

INSERT INTO <table> (<column1>, <column2>, …) VALUES (<value1>, <value2>, …)</value2></value1></column2></column1>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How can the INSERT command be simplified?

A

INSERT INTO <table> VALUES (<value1>, <value2>, …) when all columns are used in correct order</value2></value1>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are wildcards in SQL?

A

Used to specify any possible value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How are wildcards typically notated in SQL?

A

With an asterisk (*)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What command is used to create a new database table in SQL?

A

CREATE command

17
Q

What does the CREATE command specify?

A
  • Name of the new table
  • Attributes and their data types
  • Entity identifiers like primary and secondary keys
18
Q

What does the CREATE command do?

A

Creates an empty table

19
Q

What is the CHAR data type in SQL?

A

A fixed-length string with a specified number of characters

20
Q

What is the VARCHAR data type in SQL?

A

A variable-length string with a maximum specified number of characters

21
Q

What is the INT data type in SQL?

A

An integer stored using a specified number of bits

22
Q

What does the FLOAT data type represent?

A

A number with a fractional part stored with specified bits and precision

23
Q

What format is the DATE data type in SQL?

24
Q

What is the format of the DATETIME data type in SQL?

A

YYYY-MM-DD HH:MM:SS

25
What format does the TIME data type use?
HH:MM:SS
26
What does the YEAR data type store?
A year in YY or YYYY format
27
What is the function of client-server databases?
Provide simultaneous access to a database for multiple clients
28
What problem can occur with concurrent access in databases?
Database updates being lost if two users edit a record at the same time
29
What methods can manage concurrent access in databases?
* Record locks * Serialisation * Timestamp ordering * Commitment ordering
30
What is a record lock?
Locks a record for one user, blocking others until it is unlocked
31
What is serialisation in database access management?
Queues requests from users instead of locking a field
32
What is timestamp ordering?
Commands are executed based on the order of their timestamps
33
What is commitment ordering?
An algorithm determines the optimal order to execute commands based on impact