Search⌘ K

Quiz on Joins and Subqueries

Test your understanding of joins and subqueries.

We'll cover the following...
Technical Quiz
1.

Assume that we have two tables, customers and orders, as follows:

1) create table customers (id int(11) not null auto_increment, name varchar(255) not null, primary key(id));
2) create table orders (id int(11) not null auto_increment, customer_id int(11) not null, order_number varchar(255) not null, primary key(id));
3) alter table orders add constraint orders_customer_fk foreign key(customer_id) references customers(id);

What is the command to retrieve all the customers together with their orders?

A.
select * from customers join orders on orders.customer_id = customers.id;
B.
select * from customers join orders on customers.id = orders.customer_id;
C.

Both A and B

D.

None of the above


1 / 10