13 Haziran 2021 Pazar

Sql Giriş

 select*from Employees

select FirstName,LastName,Title from Employees

select*from customers 

select ContactName,Country from Customers --Tüm veriler

select ContactName,Country from customers

select*from [Order Details] where Quantity>5 and ProductID>20 and UnitPrice>20

select UnitPrice as birim_fiyati,Quantity as miktar,UnitPrice*Quantity as ucret from [Order Details]

select*from Orders

select*from orders where OrderDate>'1996-07-24'

select*from Orders where CustomerID<='e' --eden önceki harfleri gösterir

select*from Customers

select CustomerID,CompanyName,Address,Country,Phone  from Customers

select FirstName,LastName,Title,city,Country from Employees where Country='USA' and City='Seattle'

select*from Products where UnitsInStock='0'

select*from Employees where HireDate>'01.01.1993' and HireDate<'01.01.1994'

select*from [Order Details] where UnitPrice>20 or Quantity<10 

select UnitPrice,(UnitPrice*10)/100+UnitPrice as [KDV'li fiyat]  from [Order Details] where UnitPrice>50

select*from Customers where Country in ('France','Spain','mexico','canada')

select*from Employees where FirstName>'d'

select distinct country from Customers

select distinct quantity from [order details]

select distinct unitprice from [Order Details]

select*from Employees where region is null

select*from Employees where region is not null

select*from Employees order by FirstName asc

select*from Employees order by FirstName desc

select*from Products where UnitPrice>20 order by UnitPrice,UnitsInStock asc

select*from Employees order by city,title,FirstName asc

select*from Employees order by city,title,FirstName desc

select top 5*from Customers

select top 10 percent*from customers order by CustomerID desc

select top 20 percent*from Employees

select top 10*from Products where UnitPrice>20 order by NEWID()

select*from Employees where LastName like 'd%'--d ile başlayan isimler

select*from Employees where LastName like '%d%'--içinde d olan isimler

select*from Employees where LastName like '%h'--sonda h olan isimler

select*from Employees where LastName like '_u%' --soyisminde ikinci karakterinde u harfi olan

select*from Employees where FirstName like '[ar]%'

select*from Employees where FirstName like '[a-r]%' --a ile r arasında

select*from Employees where FirstName like '[^a]%' --adı a ile başlamayan

select FirstName,LastName as [isim soyisim] from Employees

select FirstName+' '+LastName as [isim soyisim] from Employees

select ProductName,UnitsOnOrder from Products where UnitsOnOrder!=0 order by UnitsOnOrder desc

select top 3*from Employees where title='sales representative' order by FirstName asc

select top 20 percent*from Products where UnitPrice between 10 and 30

select distinct SupplierID from Products

select CompanyName,ContactName  from Customers where ContactName like '_[a-c]%' --ikinci harfi a yada c olan contactname

select CustomerID from Customers where CustomerID like '%[cdn]'

select CustomerID from Customers where CustomerID like '[^ak]_[lsn]%'

select CustomerID from Customers where CustomerID like '_[^a]%'







Hiç yorum yok:

Yorum Gönder