SQL OD ZERA - #2 WHERE

  • Home
  • /
  • SQL OD ZERA - #2 WHERE

Mateusz Baczewski / 11 czerwca 2024

KURS SQL - PRZYGOTOWANIA

Odcinek pierwszy (przygotowanie środowiska): https://www.youtube.com/embed/I7YyA0iQJO0?si=HBn1_PqxJdyzCoAq

DB Browser for SQL Lite: https://sqlitebrowser.org/

Baza danych do pobrania: https://www.sqlitetutorial.net/sqlite-sample-database/

KURS SQL - ZAPYTANIA

WYBIERANIE DANEJ WARTOŚCI

SELECT *
FROM employees
WHERE title = 'IT Staff'
                        
SELECT *
FROM employees
WHERE title IN ('IT Staff', 'IT Manager')
                        
SELECT *
FROM employees
WHERE title IN ('IT Staff', 'IT Manager', 'Sales Manager')
                        

ZAPRZECZENIA

SELECT *
FROM employees
WHERE title != 'IT Staff'
                        
SELECT *
FROM employees
WHERE title <> 'IT Staff'
                        
SELECT *
FROM employees
WHERE NOT title = 'IT Staff'
                        
SELECT *
FROM employees
WHERE title
NOT IN ('IT Staff', 'IT Manager', 'Sales Manager')
                        

WIĘKSZE MNIEJSZE

SELECT *
FROM invoices
WHERE `Total` = 1.98
                        
SELECT *
FROM invoices
WHERE `Total` > 1.98
                        
SELECT *
FROM invoices
WHERE `Total` >= 1.98
                        
SELECT *
FROM invoices
WHERE `Total` < 1.98
                        
SELECT *
FROM invoices
WHERE `Total` <= 1.98
                        

BETWEEN AND

SELECT *
FROM invoices
WHERE total
BETWEEN 0.99 AND 3.96
                        
SELECT *
FROM invoices
WHERE InvoiceDate
BETWEEN '2009-01-01 00:00:00' AND '2009-01-03 00:00:00'
                        
SELECT *
FROM invoices
WHERE InvoiceDate
NOT BETWEEN '2009-01-01 00:00:00' AND '2009-01-03 00:00:00'
                        
Tagi: SQL