SQL Flashcards

1
Q

What is SQL?

A

Structured Query Language, used to communicate with the Database

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

How is data organised in a relational database?

A

In tables

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

What is a primary key?

A

It is a single field or combination of fields that defines the uniqueness of a row. A primary key cannot be null.

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

What is a foreign key?

A

field which can uniquely identify each row in another table.

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

What is a join?

A

A join defines the relationship betweem two tables. It links fields from each table that contain matching data.

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

Image I had a table called table and I wanted to select all the data from it, what would the command be?

A

select * from table;

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

Can you explain what a self join is and give an example?

A

A self join is a join which allows the table to join to itself. An example could be an employee table with managers. A manager is also an employee and you would therefore have to join to itself to get a relationship with an employee and manager.

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