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.
Tag: mysql database
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 –…
MySQL Tutorial – MySQL SELECT command
MySQL SELECT command is used to select record in a table. SELECT command is one of the most useful commands in SQL. The syntax of SELECT command: SELECT column_names FROM table_name; Here is our database table: (employee_record) [TABLE=3]
MySQL Tutorial – MySQL DELETE command
MySQL Tutorial – MySQL DELETE command The DELETE command is used to delete records in a table. The syntax of DELETE command: DELETE FROM table_name WHERE [conditions]; Note: The where clause in the delete command specifies which records should be…
MySQL Tutorial – MySQL UPDATE Command
MySQL Tutorial – MySQL UPDATE Command This lesson will teach us how to update our records in the database. The UPDATE command is used to update records in the table. Here is the general form of UPDATE command: UPDATE table_name…