0% found this document useful (0 votes)
4 views2 pages

CSDL - Edit

The document outlines a database schema with tables for Customers, Orders, Orderlines, and Products, along with SQL syntax for querying data. It includes specific queries to retrieve information such as details of red products, customer counts by country, customers who have not ordered, products ordered in November 2018, average order amounts, and products that have not been ordered yet. The document serves as a guide for constructing SQL queries based on the provided schema.

Uploaded by

tanphuc905
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

CSDL - Edit

The document outlines a database schema with tables for Customers, Orders, Orderlines, and Products, along with SQL syntax for querying data. It includes specific queries to retrieve information such as details of red products, customer counts by country, customers who have not ordered, products ordered in November 2018, average order amounts, and products that have not been ordered yet. The document serves as a guide for constructing SQL queries based on the provided schema.

Uploaded by

tanphuc905
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Cho CSDL:

Customers(customerid,firstname,lastname,address,city,countr
y,email,phone,gender)
Orders(orderid,customerid,netamount,tax,totalamount,orderda
te)
Orderlines(orderlineid,orderid,productid,quantity)
Products(productid,color,title,price)

• Cú pháp câu lệnh SQL:


SELECT [DISTINCT] <DS cột> | * | <Biểu thức> | <Hàm TV>
FROM <DS bảng>
[WHERE <Điều kiện tìm kiếm>]
[GROUP BY <DS cột> [HAVING <Điều kiện>]]
[ORDER BY <Danh sách cột> [ASC | DESC]]
[UNION | INTERSECT | MINUS <Câu truy vấ n khác>]

1. Give inf (productid,title) of red products

2. Give list of customer’s countries,number of customers


each country

3. Give inf customerid,firstname,lastname of customers


which have not ordered any product yet.

Cho CSDL:
Customers(customerid,firstname,lastname,address,city,countr
y,email,phone,gender)
Orders(orderid,customerid,netamount,tax,totalamount,orderda
te)
Orderlines(orderlineid,orderid,productid,quantity)
Products(productid,color,title,price)

4. Give inf (productid,title) of products ordered in


November 2018

(orderlineid,orderid,productid,quantity,color,title,price,
customerid,netamount,tax,totalamount,orderdate)

Select productid,title

p/s:chỉ cho tháng Month(orderdate)=11


4’. Give inf (productid,title) of products ordered in
November

5. Give avg of all orders

6. Give inf (productid,title) of products which haven’t


ordered yet

You might also like