-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession2.sql
More file actions
60 lines (52 loc) · 1.3 KB
/
session2.sql
File metadata and controls
60 lines (52 loc) · 1.3 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--limit kullanımı
SELECT InvoiceDate,InvoiceId,total
FROM invoices
WHERE total>10
LIMIT 3;
-- order kullanımı
SELECT *
FROM invoices
WHERE total>10
ORDER BY total ASC; --ASC burada defaulttur yazmasak da olur...
SELECT *
FROM invoices
WHERE total >10
ORDER BY InvoiceDate DESC
LIMIT 10;
-- AND,OR,NOT logic expressions..
SELECT *
FROM invoices
WHERE NOT BillingCountry= "USA"
ORDER BY total DESC;
SELECT *
FROM invoices
WHERE BillingCountry != "USA"
ORDER BY total desc;
SELECT *
FROM invoices
WHERE BillingCountry="USA" OR BillingCountry="Germany"
ORDER BY InvoiceId ASC;
SELECT *
FROM invoices
WHERE InvoiceDate >= "2012-01-01" AND InvoiceDate <= "2013-01-02 00:00:00";
-- BETWEEN logic operator sonrasında iki durum ve AND kullanılır... Her iki ifadeyi de alır, ayrıca tahi kullanırken sonuna 23:59:00 vb.
-- de eklemek geerkir, saat olarak...
SELECT *
FROM invoices
WHERE InvoiceDate BETWEEN "2009-01-01" AND "2011-12-31"
ORDER BY InvoiceDate DESC
LIMIT 1;
-- IN operatörü kullanımı....
SELECT FirstName,LastName,country
FROM customers
WHERE country IN ("Belgium","Norway","USA","Canada");
--- LIKE operatörü kullsnımı...
SELECT name,composer
FROM tracks
WHERE Composer LIKE "%Bach";
SELECT *
FROM albums
WHERE Title LIKE "%Greatest%";
SELECT *
FROM invoices
WHERE InvoiceDate LIKE "201_-02%";