SELECT * FROM Customers
WHERE City='Berlin'
OR City='München';
Back
SQL WHERE Clause
Front
The WHERE clause is used to extract only those records that fulfill a specified criterion
Back
SQL INSERT INTO Statement
Front
used to insert new records in a table.
Back
SQL SELECT Statement
Front
The SELECT statement is used to select data from a database.
The result is stored in a result table, called the result-set
Back
SQL UPDATE SYNTAX
Front
UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;
The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!
Back
SQL ORDER BY Syntax
Front
SELECT column_name,column_name
FROM table_name
ORDER BY column_name,column_name ASC|DESC;
to identify the unique records in the list of records,also may use Distinct syntax can be used to order by single column or multiple columns.When using multiple columns, use the asc/desc next to the column name in whom you wish to see the order
Back
SQL DELETE Syntax
Front
DELETE FROM table_name
WHERE some_column=some_value;
Back
SQL SELECT Syntax
Front
To select specific columns:
SELECT column_name, column_name
FROM table_name;
and /or
To select entire columns in a table
SELECT * FROM table_name;
Back
SQL UPDATEStatement
Front
The UPDATE statement is used to update existing records in a table.
Back
Operators in The WHERE Clause
Front
= Equal
<> Not equal. Note: In some versions of SQL this operator may be written as !=
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
BETWEEN Between an inclusive range
LIKE Search for a pattern
IN To specify multiple possible values for a column
Back
SQL SELECT DISTINCT Statement
Front
To select and return only distinct values.
This command is used when we know that the table has duplicate values and we require only DISTINCT values.
This command is useful to identify the unique values in a tables.
Back
What is RDBMS?
Front
RDBMS stands for Relational Database Management System.
RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
The data in RDBMS is stored in database objects called tables.
A table is a collection of related data entries and it consists of columns and rows.
Back
SQL INSERT INTO Syntax
Front
INSERT INTO table_name (column1,column2,column3,...)
VALUES ('value1','value2','value3',...);
Can be used to insert values in all columns or in only specific columns.The columns where no value is inserted will display as Null.
Back
SQL ORDER BY Keyword
Front
The ORDER BY keyword is used to sort the result-set by one or more columns.
The ORDER BY keyword sorts the records in ascending order by default. To sort the records in a descending order, you can use the DESC keyword.
Back
SQL Operators Combining AND & OR
Front
SELECT * FROM Customers
WHERE Country='Germany'
AND (City='Berlin' OR City='München');
Back
SQL AND Operators Syntax
Front
SELECT * FROM Customers
WHERE Country='Germany'
AND City='Berlin';
Back
SQL WHERE Clause syntax
Front
SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;
Back
SQL SELECT DISTINCT Syntax
Front
To select the distinct values from specific columns
SELECT DISTINCT column_name,column_name FROM table_name;
Back
What Can SQL do?
Front
• SQL can execute queries against a database
•SQL can retrieve data from a database
•SQL can insert records in a database
•SQL can update records in a database
•SQL can delete records from a database
•SQL can create new databases
•SQL can create new tables in a database
•SQL can create stored procedures in a database
•SQL can create views in a database
•SQL can set permissions on tables, procedures, and views
Back
Some of The Most Important SQL Commands
Front
•SELECT - extracts data from a database
•UPDATE - updates data in a database
•DELETE - deletes data from a database
•INSERT INTO - inserts new data into a database
•CREATE DATABASE - creates a new database
•ALTER DATABASE - modifies a database
•CREATE TABLE - creates a new table
•ALTER TABLE - modifies a table
•DROP TABLE - deletes a table
•CREATE INDEX - creates an index (search key)
•DROP INDEX - deletes an index
Back
SQL DELETE Statement
Front
The DELETE statement is used to delete rows in a table.
Back
What is SQL
Front
SQL is a standard language for accessing databases.
•SQL stands for Structured Query Language
•SQL lets you access and manipulate databases
•SQL is an ANSI (American National Standards Institute) standard
Back
What do you need if you want to show data from my webpage
Front
Using SQL in Your Web Site
To build a web site that shows data from a database, you will need:
•An RDBMS database program (i.e. MS Access, SQL Server, MySQL)
•To use a server-side scripting language, like PHP or ASP
•To use SQL to get the data you want
•To use HTML / CSS
Back
SQL AND & OR Operators
Front
The AND & OR operators are used to filter records based on more than one condition.
The AND operator displays a record if both the first condition AND the second condition are true.
The OR operator displays a record if either the first condition OR the second condition is true.