SQL Queries
use classicmodels;
select * from products;
select * from orderdetails;
select p.productName,
p.productCode,
o.priceEach,
o.quantityOrdered
from products as p
inner join orderdetails as o
using(productCode);
select p.productName,
p.productCode,
o.priceEach,
o.quantityOrdered
from products as p
inner join orderdetails as o
using(productCode)
where quantityOrdered>=30;
select p.productName,
p.productCode,
o.priceEach,
o.quantityOrdered
from products as p
left join orderdetails as o
using(productCode)
where quantityOrdered>=30;
select p.productName,
p.productCode,
o.priceEach,
o.quantityOrdered
from products as p
left join orderdetails as o
using(productCode)
where quantityOrdered>=30 and priceEach>100;
select p.productName,
p.productCode,
o.priceEach,
o.quantityOrdered
from products as p
left join orderdetails as o
using(productCode)
where quantityOrdered>=30 and priceEach>100 and productCode like 's12%'
order by productCode;
Comments
Post a Comment