The IN function can be used to replace the OR condition. It is also used to specify multiple value together with the WHERE clause. The syntax of IN function: SELECT column_name(s) FROM table_name Where column_name IN (value1,value2,etc…);
MySQL
MySQL – relational database management system. MySQL commands, lessons and tutorials.
MySQL Tutorial – Using HAVING clause
Using HAVING clause HAVING clause is somewhat similar to WHERE clause and it is used together with the GROUP BY clause. It was added to SQL to combine with the aggregate functions because the WHERE clause doesn’t allow aggregates. The…
MySQL Tutorial – Using Column Aliases
Column Aliases To rename a column in database table, use the AS keyword it allows you to alias the name to different value. The syntax of AS keyword: SELECT column_name(s)AS alias_name FROM table_name AS keyword example: SELECT f_name AS Firstname…
MySQL Tutorial – SQL Aggregate Functions
SQL Aggregate Functions (MIN, MAX, SUM, AVG, COUNT) MIN() – returns the minimum value of the selected field. MIN() syntax: SELECT MIN(column_name) FROM table_name; MIN() Example: SELECT MIN(salary) FROM employee_record; It will display the minimum salary.
MySQL Tutorial – LIKE Operator
LIKE operator The LIKE operator is used to retrieve records from database table by matching pattern in SELECT SQL statement. The syntax of LIKE operator: SELECT column_name(s) FROM table_name LIKE “value”; Let’s see some example: Here is our database table:…
MySQL Tutorial – Limiting Data Retrieval
Limiting Data Retrieval The LIMIT clause is used to limit the records to be displayed in the result set. The syntax of LIMIT clause: SELECT column_name(s) FROM table_name LIMIT startingROW, valueToExtract; Let’s see some example: Here is our database table:…
MySQL Tutorial – The GROUP BY clause
The GROUP BY clause The GROUP BY clause is used to group similar data specified by a certain field in your table. The GROUP BY clause syntax: SELECT column_name(s) FROM table_name GROUP BY column_name;
MySQL Tutorial –MySQL AND & OR Operators
MySQL Tutorial –MySQL AND & OR Operators AND operator is used to display records if both the first and second condition is TRUE. It can be used in SQL statement such as SELECT, UPDATE, DELETE. AND operator syntax: SELECT column_name(s)…
MySQL Tutorial – Using the WHERE clause
MySQL Tutorial – Using the WHERE clause to filter records The WHERE clause is used to filter the data to be displayed using the SQL commands such as SELECT, UPDATE, DELETE statement. The WHERE clause syntax: SELECT column_name(s) FROM table_name…
MySQL Tutorial – MySQL Order BY Clause
MySQL Tutorial – MySQL Order BY Clause The ORDER BY clause is used to sort the records in the result set specified by a column name. You can sort the record in ascending (ASC) or descending (DESC) order. ASC –…