-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLQuery2.sql
32 lines (21 loc) · 946 Bytes
/
SQLQuery2.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--Select
select ContactName Adi, CompanyName Sirketadi, City Sehir from Customers
select * from Customers where City = 'London'
select * from Products where CategoryID = 1 and UnitPrice >= 10
select * from Products where CategoryID = 1 order by UnitPrice desc
select COUNT(*) from Products
select categoryID, COUNT(*) adet from Products group by CategoryID
select CategoryID, COUNT(*) from Products where UnitPrice > 20
group by CategoryID having COUNT(*) < 10
select Products.ProductID, Products.ProductName, Products.UnitPrice , Categories.CategoryName
from Products inner join Categories
on Products.CategoryID = Categories.CategoryID
where Products.UnitPrice > 10
--DTO data transform object
select * from Products p inner join [Order Details] od
on p.ProductID = od.ProductID
inner join Orders o
on o.OrderID = od.OrderID
select * from Customers c left join Orders o
on c.CustomerID = o.CustomerID
where o.CustomerID is null