Define Mobile Menu

The SQL SELECT statement is used to select data from a SQL database table. This is usually the very first SQL command every SQL newbie learns and this is because the SELECT SQL statement is one of the most used SQL commands. SELECT “column_name” FROM “table_name” Distinct The SQL DISTINCT clause is used together with the SQL SELECT keyword, to return a dataset with unique entries for certain database table column. SELECT DISTINCT “column_name” FROM “table_name” Where The SQL WHERE clause is used to select data conditionally, by adding it to already existing SQL SELECT query.

We are going to use the Customers table from the previous chapter, to illustrate the use of the SQL WHERE command. SELECT “column_name” FROM “table_name” WHERE “condition” And/Or The SQL AND clause is used when you want to specify more than one condition in your SQL WHERE clause, and at the same time you want all conditions to be true. The SQL OR statement is used in similar fashion and the major difference compared to the SQL AND is that OR clause will return all rows satisfying any of the conditions listed in the WHERE clause. SELECT “column_name” FROM “table_name” WHERE “simple condition” {[AND|OR] “simple condition”}+ Order By

The SQL ORDER BY clause comes in handy when you want to sort your SQL result sets by some column(s). For example if you want to select all the persons from the already familiar Customers table and order the result by date of birth, you will use the following statement: SELECT “column_name” FROM “table_name” [WHERE “condition”] ORDER BY “column_name” [ASC, DESC] Insert Into Statement The SQL INSERT INTO syntax has 2 main forms and the result of either of them is adding a new row into the database table. The first syntax form of the INSERT INTO SQL clause doesn’t specify the column names where the data will be inserted, but just their values:

INSERT INTO “table_name” (“column1”, “column2”, … ) VALUES (“value1”, “value2”, … ) Update Statement he SQL UPDATE clause changes the data in already existing database row(s) and usually we need to add a conditional SQL WHERE clause to ourSQL UPDATE statement in order to specify which row(s) we intend to update. UPDATE “table_name” SET “column_1” = [new value] WHERE {condition} Delete From Statement If you skip the SQL WHERE clause when executing SQL DELETE expression, then all the data in the specified table will be deleted. DELETE FROM “table_name” WHERE {condition}



Get your custom essay sample



Hi there, would you like to get such a paper? How about receiving a customized one?

Check it out