-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment2.sql
More file actions
47 lines (34 loc) · 1.12 KB
/
assignment2.sql
File metadata and controls
47 lines (34 loc) · 1.12 KB
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
35
36
37
38
39
40
41
42
43
44
SELECT COUNT(DISTINCT year(InvoiceDate))
FROM invoices;
SELECT DISTINCT(InvoiceDate)
FROM invoices;
SELECT DISTINCT(datetime(InvoiceDate))
FROM invoices;
SELECT customers.FirstName,customers.LastName,
invoices.InvoiceDate,invoices.Total
FROM invoices
LEFT JOIN customers
ON customers.CustomerId=invoices.CustomerId;
SELECT customers.FirstName,customers.LastName,
invoices.InvoiceDate,invoices.Total
FROM customers
LEFT JOIN invoices
ON customers.CustomerId=invoices.CustomerId;
SELECT tracks.Name,tracks.TrackId,genres.Name,genres.GenreId
FROM tracks
LEFT JOIN genres
ON tracks.GenreId=genres.GenreId;
SELECT artists.ArtistId, artists.Name,
albums.Title, albums.AlbumId
FROM artists
LEFT JOIN albums
ON artists.ArtistId=albums.ArtistId ;
-- kaç farklı yıl olduğunu yazan sorgu...
SELECT COUNT (DISTINCT strftime('%Y',InvoiceDate)) AS Different_Years
FROM invoices;
SELECT DISTINCT strftime('%Y',InvoiceDate) AS Different_Years
FROM invoices;
SELECT DISTINCT strftime('%m',InvoiceDate) AS Different_Months
FROM invoices;
SELECT COUNT (DISTINCT strftime('%d',InvoiceDate)) AS Different_Days
FROM invoices;