Section 11 - SQL & Client-Server Databases Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is SQL?

A

Structured Query Language is a declarative language used for querying and updating tables in a relational database.

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

What is a declarative language?

A

A programming paradigm that expresses the logic of computation without describing its control flow

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

What is the SELECT statement?

A

A SQL statement that is used to extract a collection of fields from a given table

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

What is the syntax of a SELECT statement?

A

SELECT [the list of fields to be displayed]
FROM [the table/tables where the data will come from]
WHERE [the list of search criteria]
ORDER BY [list the fields that the results are to be sorted on]

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

What is the difference between CHAR(n) and VARCHAR(n)?

A

CHAR is a character strong of fixed length n, whilst VARCHAR is a character string of variable length, with the max length being n.

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

What is the INSERT statement?

A

A SQL statement that is used to insert a new record into a database table

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

What is the syntax for an INSERT statement?

A

INSERT INTO tableName (column1, column2, etc)
VALUES (value1, value2, etc)

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

What is the UPDATE statement?

A

A SQL statement that is used to update a record in a database table

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

What is the syntax for an UPDATE statement?

A

UPDATE tableName
SET column1 = value1, column2 = value2, …
WHERE columnX = value

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

What is the DELETE statement?

A

A SQL statement that is used to delete a record from a database taleb

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

What is the syntax for a DELETE statement?

A

DELETE from tableName
WHERE columnX = value

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

What is a wildcard?

A

Wildcards can be used in SQL commands to specify any possible value. For example, rather than selecting a specific attribute in a SELECT command, a wildcard could be used to return all attributes.

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

What is the syntax for a wildcard?

A

In SQL, wildcards are usually notated with an asterix

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

What is the CREATE command?

A

A command that creates a new database table. You must specify the name of the new table, its attributes and their data types. Additionally, entity identifiers are specified.

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

What are the different data types for SQL?

A
  • CHAR(size)
  • VARXHAR(size)
  • INT(size)
  • FLOAT(size, precision)
  • DATE
  • DATETIME
  • TIME
  • YEAR
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a client server database system?

A

A system that provides simultaneous access to a database for multiple clients

17
Q

What is concurrent access?

A

Where different users attempt to access the same field at the same time. It can result in database updates being lost if 2 users edit a record at the same time.

18
Q

How can you prevent concurrent access?

A

You can use:
- Record locks
- Serialisation
- Timestamp ordering
- Commitment ordering

19
Q

What are record locks?

A

When a record is accessed by one user, it is locked to other users until the first user has finished using it.

20
Q

What is the issue with record locks?

A

The chance of deadlocking

21
Q

What is deadlocking?

A

Where 2 users attempt to update 2 records, however neither can proceed

22
Q

What is serialisation?

A

Instead of locking a field, requests from other users are placed in a queue. Once the first user has finished using the field, the next command is executed.

23
Q

What is timestamp ordering?

A

When multiple commands are sent to the same field in a databases they are each assigned a timestamp. Commands are then carried out on the field in the order of their timestamps

24
Q

What is commitment ordering?

A

An algorithm is used to work out the optimum order in which to execute commands for the same field. The algorithm considers the impact of commands on other parts of the database in an attempt to minimise issues.

25
Q

What are the advantages of client-server databases?

A
  • The consistency of the data is maintained as there is only one copy
  • An expensive resource (the powerful computer) can be made available to a large number of users
  • Access rights and security can be managed and controlled centrally
  • Backup and recovery can be managed centrally
26
Q

What is a Database Management System?

A

The system used for client-server databases. DBMS server software runs on the network server, whilst DBMS client server runs on individual workstations

27
Q

How does DBMS servers work?

A
  • The server software processes requests from individual workstations running DBMS client software
  • The DBSM server searches for the information and returns it back to the client workstation