GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Notizen

SQL- Relational Databases

Caitlin Bergan-Gander Computer Science GCSE Englisch 1 Seite

Inhalt der Notizen (1)

Seite 1

SQL- Relational Databases

Joining the tables

• When

we use SQL to query related tables, we first need to list all tables that

we are using in the FROM section

• We

also have to include details of how the two tables are related. We do this in the WHERE section of the code

by specifying that the primary key in one table equals a foreign key in another

table

• E.g.

SELECT PetName, PetType

FROM tblPets , tblOwners

WHERE tblPets.OwnerID = tblOwners.OwnerID AND

tblOwners.Lname='Cratchett';

PetID

OwnerID

PetName

PetType

1

2

Fido

Dog

2

2

Fluffy

Cat

3

4

Gerald

Dog

4

3

Terence

Tarantula

OwnerID

FName

LName

1

Ronald

McDonald

2

Bob

Cratchett

3

John

Smith

4

Freddie

Mercury

Would give Results:

Fido Dog

Fluffy Cat

Informationen

Beschreibung
GCSE Computer Science (Databases) Notiz am SQL- Relational Databases, erstellt von Caitlin Bergan-Gander am 22/02/2016.
Aufrufe
2
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck