wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Table relationships, SQL and Pandas joins

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What's your Valentine mood?

a)
b)
c)
d)
2.

What sort of relationships can we have between tables?

a)

One-to-one

b)

Many-to-many

c)

One-to-many

d)

None of the above

3.

INNER JOIN returns only those joined records where there is match in the condition we specify

a)

True

b)

False

4.

RIGHT JOIN says 'keep all the records in the left table, adding in any matching records from the right table'.

a)

True

b)

False

5.

FULL OUTER JOIN combines the results of both left and right outer joins and returns all (matched or unmatched) rows from the tables on both sides of the join

a)

True

b)

False

6.

Which following code creates an empty database in ipython

a)

%%sql


CREATE TABLE animals (

...

);

b)

%sql posgresql://

c)

sql sqlite://

d)

%sql sqlite://

7.

The pandas package contains functions to perform all of the joins you can have in SQL, which of these are True:

a)

merge() for combining data on common columns or indices

b)

merge() for combining DataFrames across rows or columns

c)

concat() for combining data on common columns or indices

d)

.join() for combining data on a key column or an index

8.

What argument allows you to specify the type of merging with pandas? i.e. for a Full Outer Join

a)

on='outer'

b)

type='outer'

c)

how='outer'

d)

left_on='outer'

9.

Which key declares that an index in one table is related to that in another?

a)

primary

b)

secondary

c)

foreign

d)

cross

10.

How did you do in your test?

a)
b)
c)
d)