• 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

  • SQL – Where Clause

    SQL – Where Clause

    SQL – Where Clause Table Of Contents: What Is SQL Where Clause? Syntax Of Where Clause. Examples Of Where Clause. Where Clause Operations. (1) What Is SQL Where Clause ? Where clause is used to select the specific records for you. It will only display the records you want to see. (2) Syntax Of Where Clause ? SELECT column1, column2, … FROM table_name WHERE condition; (3) Examples Of Where Clause ? Demo Data: Example-1: SELECT * FROM Customers WHERE Country=’Mexico’; Example-2: SELECT * FROM Customers WHERE CustomerID=1; (4) Where Clause Operations? Example-3: SELECT * FROM Products WHERE Price = 18;

    Read More

  • SQL – Select Distinct Statement

    SQL – Select Distinct Statement

    SQL – Select Distinct Statement Table Of Contents: What Is Select Distinct Statement? Syntax Of Select Distinct. Examples Of Select Distinct. (1) What Is Select Distinct Statement ? The SELECT DISTINCT  the statement is used to return only distinct (different) values. Inside a table, a column often contains many duplicate values; sometimes you only want to list the different (distinct) values. (2) Syntax Of Select Distinct. SELECT DISTINCT column1, column2, … FROM table_name; (3) Examples Of Select Distinct. Demo Data Example-1: Select Only Different Country Names SELECT DISTINCT Country FROM Customers; Example-2: Select a Different City and Country Combination. SELECT DISTINCT

    Read More

  • SQL – Select Statement

    SQL – Select Statement

    SQL Select Statement Table Of Contents: What Is SQL SELECT? SELECT Syntax. SELECT Examples. (1) What Is SQL Select We use the “SELECT” statement to retrieve data from the database. The data returned is stored in a result table, called the result set. (2) SELECT Syntax SELECT column1, column2, … FROM table_name; (3) SELECT Examples Demo Dataset: Example-1: SELECT CustomerName, City FROM Customers; Example-2: SELECT CustomerName, City FROM Customers; Example-3: SELECT PostalCode FROM Customers;

    Read More

  • SQL – Syntax Rules

    SQL – Syntax Rules

    SQL Syntax Rules Rules To Follow: SQL keywords are NOT case sensitive: select is the same as SELECT SQL statement cannot be followed by another statement on the same line.  Place a semicolon (;) at the end of the last clause. Example-1: SQL Select Statement SELECT column1, column2….columnN FROM table_name; Example-2: SQL CREATE TABLE Statement CREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype, ….. columnN datatype, PRIMARY KEY( one or more columns ) );

    Read More

  • SQL – Introduction

    SQL – Introduction

    SQL -Introduction (1) What Is SQL? SQL Stands for Structured Query Language. SQL is a query language which helps us to send queries to the database and get our results back. Language allows us to talk to another person and get connected with each other. Similarly, SQL language helps us to connect with the SQL database and get our results. (2) What SQL Can Do? SQL can execute queries against a database SQL can retrieve data from a database SQL can insert records into a database SQL can update records in a database SQL can delete records from a database

    Read More