Category SQL

SQL COUNT() Function

The SQL COUNT() Function The COUNT() function returns the number of rows that matches a specified criterion. Example Find the total number of rows in the Products table: SELECT COUNT(*) FROM Products;

SQL MIN() and MAX() Functions

The SQL MIN() and MAX() Functions The MIN() function returns the smallest value of the selected column. The MAX() function returns the largest value of the selected column. MIN Example Find the lowest price in the Price column: SELECT MIN(Price)…

SQL Aggregate Functions

SQL Aggregate Functions An aggregate function is a function that performs a calculation on a set of values, and returns a single value. Aggregate functions are often used with the GROUP BY clause of the SELECT statement. The GROUP BY…

SQL TOP, LIMIT, FETCH FIRST or ROWNUM Clause

The SQL SELECT TOP Clause The SELECT TOP clause is used to specify the number of records to return. The SELECT TOP clause is useful on large tables with thousands of records. Returning a large number of records can impact…

SQL DELETE Statement

The SQL DELETE Statement The DELETE statement is used to delete existing records in a table. DELETE Syntax DELETE FROM table_name WHERE condition; Note: Be careful when deleting records in a table! Notice the WHERE clause in the DELETE statement.…

SQL UPDATE Statement

The SQL UPDATE Statement The UPDATE statement is used to modify the existing records in a table. UPDATE Syntax UPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition; Note: Be careful when updating records in a table!…

SQL NULL Values

What is a NULL Value? A field with a NULL value is a field with no value. If a field in a table is optional, it is possible to insert a new record or update a record without adding a…

SQL INSERT INTO Statement

The SQL INSERT INTO Statement The INSERT INTO statement is used to insert new records in a table. INSERT INTO Syntax It is possible to write the INSERT INTO statement in two ways: 1. Specify both the column names and…

SQL NOT Operator

The NOT Operator The NOT operator is used in combination with other operators to give the opposite result, also called the negative result. In the select statement below we want to return all customers that are NOT from Spain: Example…