• SQL – Min() and Max() Function

    SQL – Min() and Max() Function

    SQL – Min() and Max() Function Table Of Contents: What Is Min() and Max() Function? Syntax Of Min() and Max() Function. Examples Of Min() and Max() Functions. (1) What Is Min() and Max() Function ? The MIN() function returns the smallest value of the selected column. The MAX() function returns the largest value of the selected column. (2) Syntax Of Min() and Max() Function. Syntax: Min() SELECT MIN(column_name) FROM table_name WHERE condition; Syntax: Max() SELECT MAX(column_name) FROM table_name WHERE condition; (3) Examples Of Min() and Max() Function. Demo Data: Example-1: SELECT MIN(Price) AS SmallestPrice FROM Products; Example-2: SELECT MAX(Price) AS LargestPrice FROM Products;

    Read More

  • SQL – Select Top Clause

    SQL – Select Top Clause

    SQL – Select Top Records Table Of Contents: What Is Select Top Records? Syntax Of Select Top Records. Examples Of Select Top Records. (1) What Is Select Top Records ? Sometimes you want to see only the top records. You can use the “SELECT TOP” clause to select top ‘n’ records. (2) Syntax Of Select Top Records ? Syntax: SQL Server / MS Access Syntax: SELECT TOP number|percent column_name(s) FROM table_name WHERE condition; Syntax: MySQL Syntax: SELECT column_name(s) FROM table_name WHERE condition LIMIT number; (3) Examples Of Select Top Records ? Demo Data: Example-1: SQL Server/MS Access SELECT TOP 3

    Read More

  • SQL – Delete Statement

    SQL – Delete Statement

    SQL – Delete Statement Table Of Contents: What Is Delete Statement? Syntax Of Delete Statement. Examples Of Delete Statement. (1) What Is Delete Statement? The DELETE statement is used to delete existing records in a table. (2) Syntax Of Delete Statement? Syntax: DELETE FROM table_name WHERE condition; (3) Examples Of Delete Statement? Demo Data: Example-1: Delete A Single Record DELETE FROM Customers WHERE CustomerName=’Alfreds Futterkiste’; Example-2: Delete All Record DELETE FROM Customers;

    Read More

  • SQL – Update Statement

    SQL – Update Statement

    SQL Update Statement Table Of Contents: What Is SQL Update Statement? Syntax Of Update Statment. Examples Of Update Statement. (1) What Is SQL Update Statement ? The UPDATE statement is used to modify the existing records in a table. If the user wants to update their records at a later point in time they can do that using the “UPDATE” statement. (2) Syntax Of SQL Update Statement. Syntax: UPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition; (3) Examples Of SQL Update Statement. Demo Data: Example-1: Updating A Single Record UPDATE Customers SET ContactName=’Alfred Schmidt’, City=’Frankfurt’ WHERE CustomerID=1;

    Read More

  • SQL – NULL Values

    SQL – NULL Values

    SQL – NULL Values Table Of Contents: What Are NULL Values? Syntax Of NULL Values. Examples Of Null Values. (1) What Are NULL Values ? Sometimes users don’t enter every asked value in the input form. If a column doesn’t have any value in it there will be NULL inside it. Database replaces the empty values with ‘NULL’. A field with a NULL value is one that has been left blank during record creation! (2) Syntax Of NULL Values ? Syntax: NULL SELECT column_names FROM table_name WHERE column_name IS NULL; SELECT column_names FROM table_name WHERE column_name IS NOT NULL; Note:

    Read More

  • SQL – Insert Into Statement

    SQL – Insert Into Statement

    SQL – Insert Into Statement Table Of Contents: What Is SQL Insert Statement? Syntax Of Insert Statement. Examples Of Insert Statement. (1) What Is SQL Insert Statement ? The INSERT INTO  statement is used to insert new records in a table. (2) Syntax Of SQL Insert Statement ? Syntax-1:Specify both the column names and the values to be inserted: INSERT INTO table_name (column1, column2, column3, …) VALUES (value1, value2, value3, …); Syntax-2: Only Specify The Values INSERT INTO table_name VALUES (value1, value2, value3, …); Note: Make sure the order of the values is in the same order as the columns in

    Read More

  • SQL – Order By Clause

    SQL – Order By Clause

    SQL – Order By Clause Table Of Contents: What Is SQL Order By Clause? Syntax Of Order By. Examples Of Order By. (1) What Is SQL Order By Clause ? The ORDER BY the keyword is used to sort the result-set in ascending or descending order. The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword. (2) Syntax Of SQL Order By Clause. Syntax: SELECT column1, column2, … FROM table_name ORDER BY column1, column2, … ASC|DESC; (3) Examples Of SQL Order By Clause. Demo Data: Example-1: ORDER BY Country SELECT * FROM

    Read More

  • SQL – And , Or , Not Operator

    SQL – And , Or , Not Operator

    SQL – And , Or , Not Operator Table Of Contents: What Is And , Or , Not Operator. Syntax Of And , Or , Not Operator. Examples Of And , Or , Not Operator. (1) What Is And , Or , Not Operator And , Or, Not Operator can be used with the “Where” clause. The AND operator displays a record if all the conditions separated by AND are TRUE. The OR operator displays a record if any of the conditions separated by OR is TRUE. The NOT operator displays a record if the condition(s) is NOT TRUE. (2) Syntax Of And , Or , Not Operator AND Syntax

    Read More