SQL Database Querying: Select, Project, Union, Difference, Product, Join, Quizzes of Computer Science

The fundamental sql database querying terms: select (retrieving specific data), project (selecting columns), union (combining tables), difference (removing common rows), product (multiplying tables), and join (combining tables with matching fields).

Typology: Quizzes

Pre 2010

Uploaded on 12/11/2009

ismo-1
ismo-1 🇺🇸

3

(1)

22 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
TERM 1
Select
DEFINITION 1
-Take rows (using criteria) from one table to create a new
table General form: Select Test From Table Example: Select
marathon_place=1 From Olympic_Marathon_Medal_Winners
Test can be any sort of criteria , , =, text comparison
TERM 2
Project
DEFINITION 2
-Take columns from a table to create new table General
form: Project Field_list From Table Example: Project
FirstName, Birthdate From Person
TERM 3
Union
DEFINITION 3
-Combine 2 tables Can only be performed if the 2 tables have
the same set of attributes General Form: Table1 + Table2
Example: If we had 2 tables Men and Women People = Men
+ Women
TERM 4
Difference
DEFINITION 4
-Remove from one table the rows also listed in a second table
General Form: Table1 Table2 Remove from Table1 any rows
that are also in Table2 Women = People - Men
TERM 5
Product
DEFINITION 5
-Multiply two tables Has all the fields from both tables
Appending/concatenating each row of second table to each
row of first table General form: Table1 x Table2 Example:
Courses x Faculty Produces all possible pairings, some may
not belong together
pf2

Partial preview of the text

Download SQL Database Querying: Select, Project, Union, Difference, Product, Join and more Quizzes Computer Science in PDF only on Docsity!

TERM 1

Select

DEFINITION 1 -Take rows (using criteria) from one table to create a new table General form: Select Test From Table Example: Select marathon_place=1 From Olympic_Marathon_Medal_Winners Test can be any sort of criteria , , =, text comparison TERM 2

Project

DEFINITION 2 -Take columns from a table to create new table General form: Project Field_list From Table Example: Project FirstName, Birthdate From Person TERM 3

Union

DEFINITION 3 -Combine 2 tables Can only be performed if the 2 tables have the same set of attributes General Form: Table1 + Table Example: If we had 2 tables Men and Women People = Men

  • Women TERM 4

Difference

DEFINITION 4 -Remove from one table the rows also listed in a second table General Form: Table1 Table2 Remove from Table1 any rows that are also in Table2 Women = People - Men TERM 5

Product

DEFINITION 5 -Multiply two tables Has all the fields from both tables Appending/concatenating each row of second table to each row of first table General form: Table1 x Table2 Example: Courses x Faculty Produces all possible pairings, some may not belong together

TERM 6

Join

DEFINITION 6 -Combines two tables BUT does not produce all pairings Combines rows from two tables if there is a match on the field General form: Table1 + Table2 On Match Example: Courses + Faculty On Courses.InstructorID=Faculty.ID