home
  Microsoft©Access JET-SQL --->progettare un db
 

  • DDL
    • CREATE TABLE nome (campo1 tipo [(size)] [NOT NULL] [index1], ... [, CONSTRAINT multifieldindex, ...]
    • CREATE [UNIQUE] INDEX nome ON table (filed [ASC|DESC], ...) [WITH PRIMARY|DISALLOW NULL|INGNORE NULL]
    • DROP TABLE nome
    • DROP INDEX nome
  • DQL
    • SELECT campo AS alias FROM tabella;
    • SELECT campo FROM tabella WHERE campo LIKE 'C*';
    • SELECT campo FROM tabella ORDER BY campo;
    • SELECT DISTINCTROW campo FROM tabella; (records)
    • SELECT DISTINCT campo FROM tabella; (valori di campo)
    • SELECT campo1 FROM tabella1 WHERE campo IN (SELECT campo2 FROM tabella2 WHERE ...);
    • SELECT SUM|AVG|MAX|MIN(campo) AS alias FROM tabella;
    • SELECT COUNT(campo1) AS alias FROM tabella GROUP BY campo2;
    • SELECT COUNT(campo1) AS alias FROM tabella GROUP BY campo2 HAVING COUNT(campo1)>...;

    • SELECT ... FROM tabella1, tabella2 WHERE ...;
    • SELECT ... FROM tabella1 INNER JOIN tabella2 ON ...;
    • SELECT ... FROM tabella1 LEFT|RIGHT OUTER JOIN tabella2 ON ...;

    • SELECT ... AS nuovatabella FROM tabella1 UNION SELECT ... FROM tabella2 ORDER BY ...;
  • DML
    • UPDATE tabella SET campo1 = '...', ... WHERE ...;
    • INSERT INTO tabella (campo1, ...) VALUES ("...", "...");
    • DELETE * FROM tabella WHERE ...;