sql-join Flashcards
What is a foreign key?
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 do you join two SQL tables?
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 do you temporarily rename columns or tables in a SQL statement?
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)