Cum se utilizeaza bazele de date de tip Sqlite -2-

0

Buna ziua doamnelor si domnilor, bine v-am regasit. Ma numesc Zero Davila iar asta e partea a doua a seriei Sqlite. Asa ca sa incepem prin a deschide baza de date care am creat-o in episodul anterior, sa schimbam modul de afisare in column, si sa incepem prin a selecta totul din table-ul COMPANY. Dupa cum vedem, nu ne mai afiseaza titlul coloanelor pentru ca nu am folosit optiunea de .header on.

UPDATE COMPANY SET ADDRESS = ‘Texas’ WHERE ID = 6;

UPDATE COMPANY SET ADDRESS = ‘Texas’, SALARY = 20000.00;

DELETE FROM COMPANY WHERE ID = 7;

DELETE FROM COMPANY;

SELECT * FROM COMPANY WHERE AGE LIKE ‘2%’;

SELECT * FROM COMPANY WHERE ADDRESS LIKE ‘%-%’;

SELECT * FROM COMPANY WHERE AGE GLOB ‘2*’;

SELECT * FROM COMPANY WHERE ADDRESS GLOB ‘*-*’;

SELECT * FROM COMPANY LIMIT 6;

SELECT * FROM COMPANY LIMIT 3 OFFSET 2;

SELECT * FROM COMPANY ORDER BY SALARY ASC;

SELECT * FROM COMPANY ORDER BY NAME, SALARY ASC;

SELECT * FROM COMPANY ORDER BY NAME DESC;

SELECT NAME, SUM(SALARY) FROM COMPANY GROUP BY NAME;

INSERT INTO COMPANY VALUES (8, ‘Paul’, 24, ‘Houston’, 20000.00 );

INSERT INTO COMPANY VALUES (9, ‘James’, 44, ‘Norway’, 5000.00 );

INSERT INTO COMPANY VALUES (10, ‘James’, 45, ‘Texas’, 5000.00 );

SELECT NAME, SUM(SALARY) FROM COMPANY GROUP BY NAME ORDER BY NAME;

SELECT NAME, SUM(SALARY)
FROM COMPANY GROUP BY NAME ORDER BY NAME DESC;

SELECT * FROM COMPANY GROUP BY name HAVING count(name) < 2;

SELECT * FROM COMPANY GROUP BY name HAVING count(name) > 2;

SELECT name FROM COMPANY;

SELECT DISTINCT name FROM COMPANY;

Leave A Reply

Your email address will not be published.