sql-join Flashcards

1
Q

What is a foreign key?

A

A foreign key is a column of a table that refers to another column in another table.

or

A foreign key is a column whose name and values are shared between two columns.

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

How do you join two SQL tables?

A

select *
from (name of table in double quotes)
join (name of table in double quotes) using (name of column in both tables in double quotes surrounded by parentheses)

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

How do you temporarily rename columns or tables in a SQL statement?

A

select (name of table in double quotes).(shared column name in double quotes) as (new name in double quotes)
(name of second table in double quotes).(shared column name in double quotes) as (new name in double quotes)
from (name of first table in double quotes)
join (name of second table in double quotes) using (other shared column name in double quotes surrounded by parentheses)

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