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

SQL Queries for Orders and Employees

The document contains a series of SQL queries that retrieve various data from a database, including orders, employees, customers, and products. The queries utilize different SQL clauses such as SELECT, WHERE, JOIN, and ORDER BY to filter and organize the data. Key operations include counting customers, finding distinct countries, and calculating total prices for order details.

Uploaded by

Shavo Hakobyan
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)
5 views2 pages

SQL Queries for Orders and Employees

The document contains a series of SQL queries that retrieve various data from a database, including orders, employees, customers, and products. The queries utilize different SQL clauses such as SELECT, WHERE, JOIN, and ORDER BY to filter and organize the data. Key operations include counting customers, finding distinct countries, and calculating total prices for order details.

Uploaded by

Shavo Hakobyan
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

/*

NUMBER 8
*/

SELECT OrderID, CustomerID ,ShipCountry FROM Orders

WHERE ShipCountry ='France' or ShipCountry ='Belgium'

/*
NUMBER 9
*/
SELECT OrderID, CustomerID ,ShipCountry FROM Orders

WHERE ShipCountry in('Brazil','Mexico','Argentina','Venezuela')

/*
NUMBER 10
*/
SELECT FirstName, LastName, BirthDate FROM Employees

ORDER By BirthDate

/*
NUMBER 11
*/

/* tarberak 1 */
SELECT BirthDate, CAST(BirthDate AS DATE) FROM Employees

/* Tarberak 2 */
USE [Northwind]
GO

SELECT [FirstName] +' '+ [LastName] AS [Full Name]


,CAST([BirthDate] AS date) AS [Date]
FROM [Employees]

ORDER BY BirthDate DESC

/* NUMBER 13 */
SELECT OrderID ,ProductID , UnitPrice,Quantity , TotalPrice = UnitPrice *
Quantity FROM [Order Details]

ORDER BY OrderID ,ProductID

/* NUMBER 14 */
SELECT COUNT(*) AS CountCustomer FROM Customers;

/* NUMBER 15 */

SELECT MIN(OrderDate) As FirstDate


FROM Orders

/* NUMBER 16 */
SELECT DISTINCT Country FROM Customers

WHERE Country in ( SELECT Country FROM Orders)

/* NUMBER 17 */
SELECT DISTINCT ContactTitle FROM Customers
WHERE ContactTitle in (SELECT ContactTitle FROM Employees)
ORDER BY ContactTitle DESC

/* NUMBER 18 Column 1 ? Column 2 ? */


SELECT ProductID , ProductName,CompanyName FROM Products
LEFT JOIN Suppliers
ON [Link] = [Link]

/* NUMBER 19 */
SELECT OrderID ,CAST( [OrderDate] AS DATE ) AS OrderDate, CompanyName FROM
Orders
INNER JOIN Shippers ON OrderID < 10300

/* NUMBER 20 */
SELECT DISTINCT CategoryName FROM Categories
JOIN Products ON [Link] = [Link]

You might also like