🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Transcript

SQL STRUCTURED Q U E R Y LANGUAGE JAY-R L. DE LEON, LPT SQL AND The WHERE clause can contain one or many AND operators. SYNTAX All Conditions Must Be True. The following SQL statement selects all fields from Customers where Country is "Germany" AND City is "Berlin" AND PostalCode is...

SQL STRUCTURED Q U E R Y LANGUAGE JAY-R L. DE LEON, LPT SQL AND The WHERE clause can contain one or many AND operators. SYNTAX All Conditions Must Be True. The following SQL statement selects all fields from Customers where Country is "Germany" AND City is "Berlin" AND PostalCode is higher than 12000: SQL OR The WHERE clause can contain one or more OR operators. The OR operator is used to filter records based on more than one condition. SYNTAX NOTE: SQL NOT The NOT operator is used in combination with other operators to give the opposite result, also called the negative result. SYNTAX SQL INSERT INTO SELECT it copies data from one table and inserts it into another table. It requires that the data types in source and target tables match. SYNTAX Copy all columns from one table to another table: SYNTAX Copy only some columns from one table into another table: EXAMPLE Copy "Suppliers" into "Customers" (the columns that are not filled with data, will contain NULL): EXAMPLE Copy "Suppliers" into "Customers" (fill all columns): EXAMPLE Copy only the German suppliers into "Customers": SQL CASE The CASE expression goes through conditions and returns a value when the first condition is met (like an if-then-else statement). So, once a condition is true, it will stop reading and return the result. If no conditions are true, it returns the value in the ELSE clause. SYNTAX EXAMPLE EXAMPLE SQL PRIMARY KEY The PRIMARY KEY constraint uniquely identifies each record in a table. Primary keys must contain UNIQUE values, and cannot contain NULL values. EXAMPLE SQL FOREIGN KEY The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables. A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the PRIMARY KEY in another table. The table with the foreign key is called the child table, and the table with the primary key is called the referenced or parent table. EXAMPLE Thank You For Your Attention

Tags

SQL database management query language
Use Quizgecko on...
Browser
Browser