SQL Flashcards
What is SQL?
Structured Query Language, used to communicate with the Database
How is data organised in a relational database?
In tables
What is a primary key?
It is a single field or combination of fields that defines the uniqueness of a row. A primary key cannot be null.
What is a foreign key?
field which can uniquely identify each row in another table.
What is a join?
A join defines the relationship betweem two tables. It links fields from each table that contain matching data.
Image I had a table called table and I wanted to select all the data from it, what would the command be?
select * from table;
Can you explain what a self join is and give an example?
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.