Anwendungsentwicklung (Fach) / SQL (Lektion)
In dieser Lektion befinden sich 42 Karteikarten
kleines SQL Tutorial in Form von Karteikarten
Diese Lektion wurde von L3r0th erstellt.
- Was ist SQL? SQL steht für Structured Query Language (strukturierte Abfragesprache) Mit SQL können Sie auf Datenbanken zugreifen und diese manipulieren. SQL wurde 1986 zum Standard des American National Standards Institute (ANSI) und 1987 zur Norm der Internationalen Organisation für Normung (ISO).
- Was kann SQL? SQL kann Abfragen gegen eine Datenbank ausführenSQL kann Daten aus einer Datenbank abrufenSQL kann Datensätze in eine Datenbank einfügenSQL kann Datensätze in einer Datenbank aktualisierenSQL kann Datensätze aus einer Datenbank löschenSQL kann neue Datenbanken erstellenSQL kann neue Tabellen in einer Datenbank erstellen.SQL kann gespeicherte Prozeduren in einer Datenbank erstellen.SQL kann Ansichten in einer Datenbank erzeugenSQL kann Berechtigungen für Tabellen, Prozeduren und Views festlegen
- SELECT Syntax SELECT column1, column2, ...FROM table_name;
- SELECT DISTINCT Syntax return only distinct (different) values. SELECT DISTINCT column1, column2, ...FROM table_name;
- SQL WHERE-Klausel Die WHERE-Klausel wird zum Filtern von Datensätzen verwendet. Die WHERE-Klausel wird verwendet, um nur die Datensätze zu extrahieren, die eine bestimmte Bedingung erfüllen. SELECT column1, column2, ...FROM table_nameWHERE condition;
- Operatoren in der WHERE-Klausel = Gleich > Größer als < Weniger als >= Größer oder gleich <= kleiner oder gleich <> Nicht gleich. Hinweis: In einigen Versionen von SQL kann dieser Operator als != geschrieben werden. BETWEEN Zwischen einem bestimmten Bereich LIKE Suche nach einem Muster IN So geben Sie mehrere mögliche Werte für eine Spalte an
- AND Syntax SELECT column1, column2, ...FROM table_nameWHERE condition1 AND condition2 AND condition3 ...;
- OR Syntax SELECT column1, column2, ...FROM table_nameWHERE condition1 OR condition2 OR condition3 ...;
- NOT Syntax SELECT column1, column2, ...FROM table_nameWHERE NOT condition;
- ORDER BY Syntax SELECT column1, column2, ...FROM table_nameORDER BY column1, column2, ... ASC|DESC;
- INSERT INTO Syntax INSERT INTO table_name (column1, column2, column3, ...)VALUES (value1, value2, value3, ...);
- IS NULL Syntax SELECT column_namesFROM table_nameWHERE column_name IS NULL;
- UPDATE Syntax UPDATE table_nameSET column1 = value1, column2 = value2, ...WHERE condition;
- DELETE Syntax DELETE FROM table_name WHERE condition;
- SQL SELECT TOP-Klausel 3 Schreibweisen: MS Access / SQL Server Syntax MySQL Syntax Oracle Syntax SQL Server / MS Access Syntax: SELECT TOP number|percent column_name(s)FROM table_nameWHERE condition; MySQL Syntax: SELECT column_name(s)FROM table_nameWHERE conditionLIMIT number; Oracle Syntax: SELECT column_name(s)FROM table_nameWHERE ROWNUM <= number;
- MIN() Syntax SELECT MIN(column_name)FROM table_nameWHERE condition;
-
- MAX() Syntax SELECT MAX(column_name)FROM table_nameWHERE condition;
- COUNT() Syntax SELECT COUNT(column_name)FROM table_nameWHERE condition;
- AVG() Syntax SELECT AVG(column_name)FROM table_nameWHERE condition;
- SUM() Syntax SELECT SUM(column_name)FROM table_nameWHERE condition;
- LIKE Syntax SELECT column1, column2, ...FROM table_nameWHERE columnN LIKE pattern;
- IN Syntax SELECT column_name(s)FROM table_nameWHERE column_name IN (value1, value2, ...);
- BETWEEN Syntax SELECT column_name(s)FROM table_nameWHERE column_name BETWEEN value1 AND value2;
- Alias Column Syntax SELECT column_name AS alias_nameFROM table_name;
- Alias Table Syntax SELECT column_name(s)FROM table_name AS alias_name;
- Was ist ein SQL Join A JOIN clause is used to combine rows from two or more tables, based on a related column between them.
- INNER JOIN Syntax SELECT column_name(s)FROM table1INNER JOIN table2ON table1.column_name = table2.column_name;
- LEFT JOIN Syntax SELECT column_name(s)FROM table1LEFT JOIN table2ON table1.column_name = table2.column_name;
- RIGHT JOIN Syntax SELECT column_name(s)FROM table1RIGHT JOIN table2ON table1.column_name = table2.column_name;
- FULL OUTER JOIN Syntax SELECT column_name(s)FROM table1FULL OUTER JOIN table2ON table1.column_name = table2.column_nameWHERE condition;
- Self JOIN Syntax SELECT column_name(s)FROM table1 T1, table1 T2WHERE condition;
- UNION Syntax SELECT column_name(s) FROM table1UNIONSELECT column_name(s) FROM table2;
-
- UNION ALL Syntax SELECT column_name(s) FROM table1UNION ALLSELECT column_name(s) FROM table2;
- GROUP BY Syntax SELECT column_name(s)FROM table_nameWHERE conditionGROUP BY column_name(s)ORDER BY column_name(s);
- HAVING Syntax SELECT column_name(s)FROM table_nameWHERE conditionGROUP BY column_name(s)HAVING conditionORDER BY column_name(s);
- EXISTS Syntax SELECT column_name(s)FROM table_nameWHERE EXISTS(SELECT column_name FROM table_name WHERE condition);
- ANY Syntax SELECT column_name(s)FROM table_nameWHERE column_name operator ANY(SELECT column_name FROM table_name WHERE condition);
- ALL Syntax SELECT column_name(s)FROM table_nameWHERE column_name operator ALL(SELECT column_name FROM table_name WHERE condition);
- SELECT INTO Syntax SELECT *INTO newtable [IN externaldb]FROM oldtableWHERE condition;
- INSERT INTO SELECT Syntax INSERT INTO table2SELECT * FROM table1WHERE condition;
- CASE Syntax CASE WHEN condition1 THEN result1 WHEN condition2 THEN result2 WHEN conditionN THEN resultN ELSE resultEND;
- Stored Procedure Syntax CREATE PROCEDURE procedure_nameASsql_statementGO;