SQL tasks

Homework #1

21.02.2023 2 dəq oxuma
1. Northwind database nin skriptin tap at sql e execute et, database ve table lar yaranssin +

2. Customers table-dan region u null bosh olmayan setrleri getir 
	select * from Northwind..Customers where Region is null -- Regionu haradakı null dur
	select * from Northwind..Customers where Region is not null -- Regionu haradakı null deyildir

3. Customers table-da customerId si HUNGO ve ya FAMIA olan setrleri goster,(bunu iki usul ile tapa bilersen her iki usuluda fikirles yaz)
	1) select * from Northwind..Customers where CustomerID = 'HUNGO' or CustomerID = 'FAMIA'
	2) select * from Northwind..Customers where CustomerID in ('HUNGO','FAMIA')

4. Categories table-da Description i icinde ee gelen setrleri goster
	select * from Northwind..Categories where Description like '%ee%'

5. LIKE 'a__%' strukturu arasdir, menasi nedir? hansi meqamda bu axtarisa imkan yarana biler? numune yaz.
	1-ci hərf a-dır
	Min 4 hərfli ifadədir
	hansi meqamda bu axtarisa imkan yarana biler? numune yaz. -> Bilmirəm

6. Orders table-da ShipName uzunlugu 20 den boyuk ve freight-i 15den kicik setrleri veya ShipCountry si UK ve Freight 15 olan strleri getir.
	select * from Northwind..Orders where (LEN(ShipName) > 20 and LEN(Freight) < 15) or (ShipCountry = 'UK' and Freight = 15)
	

7. Employees table-da yashi 75 den boyuk olanlari  select et ;) axtar tap.
	select * from Northwind..Employees where DATEDIFF(YEAR,BirthDate, GETDATE()) > 74

8. Customers cedvelinde 3-cu herfi n olan setrleri getir
	select * from Northwind..Customers where ContactName like '__n%'
	

9. Customers da phone sutununda axrinci reqemi 6 ile bitmeyen setrleri getir
	select * from Northwind..Customers where Phone not like '%6'

10. Customers da ContactTitle da bosluq olmayan setrleri getir.
	select ContactTitle from Northwind..Customers where ContactTitle not like '% %'
Digər dildə: EN