Category: SQL

Order By

SQL ORDER BY The keyword ORDER BY is used to sort the records of a sql query. Syntax SELECT * FROM name_of_table ORDER BY name_of_column ASC; SELECT * FROM name_of_table ORDER BY name_of_column DESC; Example Table of books ID NAME PRICE...

Like

SQL LIKE The LIKE keyword is used to return rows if the operand matches a pattern. Syntax SELECT * FROM name_of_table WHERE name_of_column LIKE pattern; Example Table of books ID NAME PRICE 1 Learn Python 45 2 MySQL Tutorial 32 3...

Between

SQL BETWEEN The BETWEEN keyword returns records between two values. Syntax SELECT * FROM name_of_table WHERE name_of_column BETWEEN value1 AND value2; Example Table of books ID NAME PRICE 1 Learn Python 45 2 MySQL Tutorial 32 3 PHP examples 24 4...

And – Or

SQL AND & OR AND returns rows from sql table if both conditions are true. OR returns rows from sql table if at least one of the conditions is true. Syntax SELECT * FROM name_of_table WHERE condition AND condition; SELECT *...

Where

SQL WHERE The WHERE condition is used to return the records that fulfill the conditions immediately after the keyword. Syntax SELECT * FROM name_of_table WHERE condition; Example Table of books ID NAME PRICE 1 Learn Python 45 2 MySQL Tutorial 32...

Distinct

SQL DISTINCT The DISTINCT is used into a select query to eliminate duplicate records and returns the unique values. Syntax SELECT DISTINCT name_of_column FROM name_of_table; Example Table of books ID NAME PRICE 1 Learn Python 45 2 MySQL Tutorial 32 3...

Select

SQL SELECT The SELECT command is used to query a database table. You can select all records or only certain records from an SQL table. Syntax SELECT * FROM name_of_table; SELECT column1, column2 FROM name_of_table; Example SELECT * FROM students; SELECT...

Delete

SQL DELETE The DELETE command is used to delete records from an SQL table. You can delete all records or only certain records from table. Syntax DELETE FROM name_of_table WHERE {condition} Example DELETE FROM students WHERE student_id=1 AND name='Tom';...

Update

SQL UPDATE The UPDATE command is used to modify records in an SQL table. You can modify all records or only certain records in a database table. Syntax UPDATE table_name SET column1 = value1, column2 = value2, column3 = value3, …...

Insert

SQL Insert The INSERT command is used to insert records into a SQL table. Syntax INSERT INTO table_name ( column_name_1, column_name_2, column_name_3, … ) VALUES ( column_value_1, column_value_2, column_value_3, … ); Example INSERT INTO students(student_id, name, age) VALUES (1,'Tom',19);...