¡GoConqr estrena diseño! Cuéntanos qué te parece.

Apuntes

SQL- Relational Databases

Caitlin Bergan-Gander Computer Science GCSE Inglés 1 página

Contenido del apunte (1)

Página 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

Información

Descripción
GCSE (Databases) Computer Science Apunte sobre SQL- Relational Databases, creado por Caitlin Bergan-Gander el 22/02/2016.
Visitas
2
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?