-
Notifications
You must be signed in to change notification settings - Fork 73
/
SQL.sql
48 lines (23 loc) · 1001 Bytes
/
SQL.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
32
33
34
--Select
--ANSII
Select ContactName Adi,CompanyName Sirketadi,City Sehir from Customers
Select * from Customers where City = 'Berlin'
--case insensitive
sElEcT * from Products where categoryId=1 or categoryId=3
select * from Products where categoryId=1 and UnitPrice>=10
select * from Products where categoryId=1 order by UnitPrice desc --ascending --descending
Select count(*) Adet from Products
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 Transformation 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