Consolidated Sequel Queries

  • Click on below mentioned image to watch video:
  • Download The ZIP from below mentioned source

    Before executing the macro:

     

  • Change the server name against DATA SOURCE in the below mentioned Connection String
  • Change the Data base name against Initial Catalog
  • ConnectionString = "Provider=SQLOLEDB;Data Source=DESKTOP-C8M3J9C;Initial Catalog=BasicQuries;Integrated Security=SSPI"

    SQL Introduction

  • SQL Introduction
  • Add Row Numbers to SQL
  • Clauses Of Select Statement
  • Database Introduction
  • Ways To Create Database
  • SQL Languages
  • DDL Language

  • DDL Language
  • Table Introduction
  • What is Meant by Table

    Structure Of the table

    Rules to Create the table

    Create the structure of table by defining data types

    Alter the structure of the table

    Add a column to the existing table

    Alter a column - Data type and Size

    Rename table

    Drop column

    DML Language - Data Manipulation Language

  • DML Language
  • Introduction

    Insert values into the table

    Update the value in entire column of the table

    Update the data of specific row

    Delete the data of specific row

    Delete all the data of all rows

  • Data Retrival Language
  •  

    Create Alias Column

  • Create Alias Table Or Alias Column in SQL
  • SQL Create Alias Column Increase Price By Ten Percent By Creating Alias Column
  • SQL Create Alias Column From the Sales Tabel retrieve Item ends with e and Price between 250 to 350 and Quantity Greater Than 1200
  • SQL Create Alias Column Decrease Sales Quantity by 10 Percent
  • SQL Create Alias Column Copy The Quantity Column Of Sales Table By Creating Alias Column
  • SQL Create Alias Column Copy The Price Column Of Sales Table By Creating Alias Column
  • SQL Create Alias Column Calculate Total Cost by Creating Alias Column
  • SQL Create Alias Column Calculate Ten Perecent Commission On Total Cost
  • From Clause

  • Select all Columns from Sales Table
  • Select Item and Quantity Columns from Sales table
  • Select Item and Code from Symbol Table
  • Select Item Column from Sales table
  • Select Item Price Quantity Location Columns From Sales
  • Select Item Column from Symbol table
  • Select Price Quantity Columns From Sales
  • Where Clause

  • Select all the columns from Sales Table where ITEM having APPLE
  • Select all the columns from Sales Table where ITEM having BANANA
  • Select all the columns from Sales Table where Location having WEST
  • Select all the columns from Symbol Table where ITEM having APPLE
  • Select all the columns of South from Sales Table where Location having SOUTH
  • Retrieve Records from all the columns of Sales table where Price column Having value Greater Than 500
  • Retrieve records from ITEM column of SALES table where PRICE column having value Less than 100
  • Retrieve records from ITEM PRICE columns of SALES table where PRICE column having value greater than 500
  • Retrieve records from ITEM column of SALES table where PRICE column having value greater than 500
  • Retrieve the Records from all the columns of Sales table where Price column Having equivalent value to 110
  • Group By Clause

  • Group By Clause Introduction
  • Provide Group Count based on Location of Sales Table Order by Alias column Descending
  • Provide the Avg Of Price Based on Item from Sales Table using Group By Clause
  • Provide the count of Price by considering group by Item from Sales table
  • Provide the Max Of Price Based on Item from Sales Table using Group By Clause
  • Provide the Min Of Price Based on Item from Sales Table using Group By Clause
  • Provide the Sum Of Price Based on Item from Sales Table using Group By Clause
  • Retrieve Count Records Apple Banana Grapes group by Item
  • Retrieve Items With Group By Clause from Sales Table
  • Retrieve Location With Group By Clause from Sales Table
  • Retrive Item Location Price from Sales table group by Location and Item
  • Provide Group Count based on Location of Sales Table Order by Alias column Ascening
  • Provide Group Count based on Location of Sales Table Order by Alias column
  • Provide Group Count based on Location of Sales Table
  • Identify Unique records in Location Column using Group By Clause
  • Identify duplicate records in Location Column using Group By Clause
  • Distinct Clause

  • Remove duplicates from Location column of Sales Table where Location is South
  • Remove duplicates from Item column of Dates Table
  • Remove duplicates from Location column of Sales Table
  • Remove duplicates from Item column of Sales Table
  • Having Clause

  • Provide the Avg Of Price Based on Item from Sales Table using Group By Clause where Average is Greater than 300
  • Provide the count of Price by considering group by Item from Sales table having count is Greater Than or Equal to 1
  • Provide the Max Of Price Based on Item from Sales Table using Group By Clause having Max Price is Greater than 350
  • Provide the Min Of Price Based on Item from Sales Table using Group By Clause having Min Price is Greater than 350
  • Provide the Sum Of Price Based on Item from Sales Table using Group By Clause where sum is Greater than 400
  • Retrieve Apple And Banana Grouped Count from Sales Table
  • Retrieve AVG sales Item wise where ITEM equals to Apple or Grapes
  • Retrieve South And East Grouped Count from Symbol Table
  • Provide Group Count based on Location of Sales Table When Each group consists of one row
  • Provide Group Count based on Location of Sales Table when count is equal two
  • Order By Clause

  • Order By Clause Introduction
  • Symbol Table Order By code
  • Order the Sales table by length of Item column
  • Order by Sales Table by Third column
  • Order by Sales Table by second column
  • Order by Sales Table by Fourth column
  • Order by Sales Table by first column
  • Order by Price column in Sales Table by Ascending
  • Order by Item column in Sales Table by Descending
  • Change the Order Of Sales Table By Price
  • Change the Order Of Sales Table By Item
  • Functions

  • Count Function
  • Counts The Items where Letter starts with M - using Count and Left Functions
  • Count Items where Quantity > 3000
  • Inner Join

  • Retrieve all records of 2020 by providing Inner Join between Sales table and Symbol table
  • Retrieve all records of East by providing Inner Join between Sales table and Symbol table
  • Retrieve Item Price Location Code records from Sales and Symbol table by providing Inner Join
  • Retrieve Item Price Location records from Sales and Symbol table by providing Inner Join where Price Greater Than 100
  • Retrieve all records by providing Inner Join between Sales table and Symbol table where Item starts with A
  • Retrieve all records by providing Inner Join between Sales table and Symbol table where ITem starts with G
  • Retrieve all records by providing Inner Join between Sales table and Symbol table where Quantity is less than 2000
  • Retrieve all records by providing Inner Join between Sales table and Symbol table where Quantity between 1200 and 1500
  • Retrieve all records by providing Inner Join between Sales table and Symbol table where Item of Sales table starts with G or Item of Symbol table ends with e
  • Provide Inner Join between Sales table and Symbol table Retrive Item Price Code Columns
  • Provide Inner Join between Sales table and Symbol table Order by Price
  • Provide Inner Join between Sales table and Symbol table
  • Right Outer Join

  • Retrieve all records by providing Right Outer Join between Sales table and Symbol table where Quantity is less than 2000
  • Retrieve all records by providing Right Outer Join between Sales table and Symbol table where ITem starts with P
  • Retrieve all records by providing Right Outer Join between Sales table and Symbol table where Location starts with S
  • Retrieve all records of 2016 by providing Right Outer Join between Sales table and Symbol table
  • Retrieve Item Price Location records from Sales and Symbol table by providing Right Outer Join
  • Retrieve Item Price Location records from Sales andSymbol table by providing Right Outer Join where Price Greater Than 100
  • Retrieve Location from Symbol table where Quantity is greater than 3000 of Sales Table
  • Retrieve all records by providing Right Outer Join between Sales table and Symbol table where Quantity between 3000 and 4000
  • Provide Right Outer Join between Sales table andSymbol table Order by Price
  • Provide Right Outer Join between Sales table andSymbol table
  • Provide Right Outer Join between Sales table and Symbol table where Item of Sales table starts with A or Item of Symbol table ends with t
  •  

    Left Outer Join

  • Provide Left Outer Join between Sales table and Symbol table
  • Provide Left Outer Join between Sales table and Symbol table Order by Price
  • Provide Left Outer Join between Sales table and Symbol table where Item of Sales table starts with A or Item of Symbol table ends with t
  • Retrieve all records by providing Left Outer Join between Sales table and Symbol table where Quantity between 3000 and 4000
  • Retrieve Location from Symbol table where Quantity is greater than 3000 of Sales Table
  • Retrieve Item Price Location records from Sales andSymbol table by providing Left Outer Join where Price Greater Than 100
  • Retrieve Item Price Location records from Sales and Symbol table by providing Left Outer Join
  • Retrieve all records of 2016 by providing Left Outer Join between Sales table and Symbol table
  • Retrieve all records by providing Left Outer Join between Sales table and Symbol table where Location starts with S
  • Retrieve all records by providing Left Outer Join between Sales table and Symbol table where ITem starts with P
  • Retrieve all records by providing Left Outer Join between Sales table and Symbol table where Quantity is less than 2000
  • Date Function

  • SQL DateDiff Function Find The date difference in days
  • SQL DateDiff Function Find The date difference in Hours
  • SQL DateDiff Function Find The date difference in Months
  • SQL DateDiff Function Find The date difference in Weeks
  • SQL DateDiff Function Find The date difference in Minutes
  • SQL Datename Function Find The WeekDay
  • SQL Datename Function Find The MonthName
  • SQL Dateadd Function Add 5 Days to the Period Column from Symbol table
  • SQL Year Function Retrieve Period Years of Symbol from Symbol table
  • SQL Day Function Retrieve Day of Symbol from Symbol table
  • SQL Month Function Retrieve Month of Period from Symbol table
  • SQL DatePart Function Retrieve Year Numbers
  • SQL DatePart Function Retrieve Month Numbers
  • SQL Dateadd Function Deduct 5 Days to the Period Column from Symbol table
  • SQL Date Functions Retrieve Item records where Year GREATER Than 2020 from Symbol table
  • SQL Date Functions Retrieve Item records where Year equal to 2021 from Symbol table
  • SQL Date Functions Retrieve Items Period Month of Period from Symbol table where month is less than June
  • SQL DatePart Function Retrieve Month Numbers Where Month Number Is Greater Than 6
  • SQL Date Functions Retrieve Year Numbers using DatePart Function where Year number greater than 2020
  • SQL DatePart Function Retrieve Week Numbers using DatePart Function where week number is greater than 10
  • SQL DatePart Function Retrieve Week Numbers using DatePart Function
  • SQL DatePart Function Retrieve Month Numbers and Month Names using DateName and DatePart Functions by Creating Alias column
  • SQL Datename Function Retrieve Month Names from Symbol Table using Month
  • SQL DateName Function Retrieve Date Week from Symbol Table using Month
  • SQL Dateadd Function Deduct 15 Days to Period from Symbol Table
  • SQL Dateadd Function Deduct 3 Months to Period from Symbol Table
  • SQL Dateadd Function Add 3 Months to Period from Symbol Table
  • SQL Dateadd Function Add 15 Days to Period from Symbol Table
  •  

    TOP Statement

  • SQL Top Statement Top 3 records based on Price from Sales table
  • SQL Top Statement Top 2 records based on Quantity from Sales table
  • SQL Top Statement Select Top 4 records of PriceItem order by Pricing from Sales table
  • SQL Top Statement Select Top 4 of Quantity Price Item records from Sales table where Quantity greater than 3000
  • SQL Top Statement Select Top 4 of Quantity Price Item records from Sales table where Quantity greater than 2000
  • SQL Top Statement Select Top 4 of Quantity Price Item records from Sales table Order by Quantity
  • SQL Top Statement Select Top 4 of Quantity Price Item records from Sales table Order by Price
  • SQL Top Statement Select Top 2 Price and Quantity records from Sales table
  • SQL Top Statement Select Top 2 Quantity Price Item records from Sales table
  •  

    In Operator

  • SQL In Operator Retrieve records from Sales table where Location represents to South OR East
  • SQL In Operator Retrieve records from Sales table where Items represents to Apple Banana Orange
  • SQL Offset and Fetch Next Statement

  • SQL Offset FetchNext Function Retrieve Third Heighest Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve Second Heighest Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve Fourth Heighest Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve First Heighest Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve First Heighest and Second Highest Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve First 5 Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve First 4 Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve First 3 Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve Fifth Heighest Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve 5th to Last Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve 4th to Last Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve 3rd to Last Price from Sales Table using Offset and Fetch Next
  • SQL Offset FetchNext Function Retrieve 2nd to Last Price from Sales Table using Offset and Fetch Next
  • SQL OR Operator

  • SQL OR Operator Retrieve Item records from Sales table where Items represents to Apple or Banana
  • SQL OR Operator Retrieve Apple records from the Column of Item or South Record from the Location of Sales table
  • SQL NOT Operator

  • SQL Not Operator Retrieve records from Sales table where price not in the range of 85 and 145
  • SQL Not Operator Retrieve records from Sales table where Price having Not NULL value
  • SQL Not Operator Retrieve records from Sales table where Items doesn't represents to Apple Banana Orange
  • SQL IS Null Operator

  • Is Null and IS Not Null Operator
  • SQL IsNull Operator Retrieve records from Sales table where Price having NULL value
  • SQL IsNull Operator Retrieve records from Sales table where Item having NULL value
  • SQL Between Operator

  • SQL Between Operator Retrieve records from Sales table where price Greater Than Equal to 85 and Less than equal to 145 Order by Quantity
  • SQL Between Operator Retrieve records from Sales table where price Greater Than Equal to 85 and Less than equal to 145
  • SQL Between Operator Retrieve Item Price from Sales table where price Greater Than Equal to 100 and Less than equal to 150
  • SQL AND Operator

  • SQL And Operator Retrieve records from Sales table where price Greater Than Equal equal to 90 and Less Than Equal To 145
  • SQL And Operator Retrieve Apple records from the Column of Item and South Record from the Location of Sales table
  • SQL And Operator From the Sales Tabel retrieve Item ends with e and Price between 250 to 350 and Quantity Greater Than 1200
  • SQL And Operator From Sales Table Retrieve Records where Price Greater Than 120 and Less than 510
  • SQL And Operator From Sales Table Quantity Greater Than 1200 and Price Greater Than 310
  • Substring Function

  • SQL Function Retrieve The Item from Sales Table which consists of APP as first 3 characters Using Substring Function
  • Count_Big(*) Function

  • SQL Function Retrieve Number of Values in Price column Of Sales Table
  • Upper Function

  • SQL Function Retrieve Item and Item in Upper case Sales Table
  • SQL Function Retrieve Item in Upper case and Price Columns From Sales Table
  • Lower Function

  • SQL Function Retrieve Item in Lower case and Price Columns From Sales Table
  • SQL Function Retrieve Item and Item in Lower case Sales Table
  • SQL Function Convert Item into Lower and Upper Cases with Alias Columns
  • Replicate Function

  • SQL Function Repeat Item 2 Times using Replicate Function
  • Replace Function

  • SQL Function Replace A with ABC
  • Reverse Function

  • SQL Function Reverse The Location From Sales Table
  • SQL Function Reverse The Item from Sales Table
  • Len Function

  • SQL Len Function Retrieve Length of Item records from Sales table
  • SQL Len Function Retrieve Item records where Length is Less than 7 from Sales table
  • SQL Len Function Retrieve Item records where Length is Greater Than Equal to 5 and Less than equal to 8 from Sales table
  • SQL Len Function Retrieve Item records where Length having Greater Than 5 from Sales table
  • Like Operator

  • SQL Like Operator Retrive records where Item starts with P or Price is less than 100 and Quantity between 2400 to 3000 from Sale
  • SQL Like Operator Retrive records where Item starts with P or B Order by Price in Asc from Sales table
  • SQL Like Operator Retrive records where Item starts with B from Sales table
  • SQL Like Operator Retrieve records which Item starts with A and Location doesn’t belongs to North from Sales table
  • MAX Function

  • SQL Max Function Select Max Quantity from Sales table
  • SQL Max Function Select Max Price from Sales table
  • MIN Function

  • SQL Min Function Select Min Price among Apple and Banana from Sales table
  • SQL Min Function Select Min Price from Sales table
  • Right Function

  • SQL Right Function Select Item and Price Columns where Item ends with e from Sales table
  • SQL Right Function Select Item and Price Columns where Item ends with R from Sales table
  • Sum Function

  • SQL Sum Function Calculate Total Cost of Apple from Sales table
  • SQL Sum Function Calculate total cost of items having price greater than 100 from Sales table
  • SQL Sum Function Calculate total cost of items having Quantity Less than 2000 from Sales table
  • SQL Sum Function Sum the Price of Items where Item starts with P from Sales table
  • SQL Sum Function Sum the QUANTITY of Items where Item Ends with e from Sales table
  • SQL Sum Function Sum the QUANTITY of Items where Price Greater Than 100 from Sales table
  • Left Function

  • SQL Left Function Select Item Column where Item starts with P from Sales table
  • SQL Left Function Select Item Column where Item starts with A from Sales table
  • Rtrim Function

  • SQL Function Rtrim Remove The Spaces At right Side
  • Ltrim Function

  • SQL Function LTrim Remove The Spaces At Left Side
  • Col_Legth Function

  • SQL Function Find The Column Length of Item from Sales Table
  • Add Operator

  • SQL Add Operator Combine Item and Location from Sales table
  • SQL Add Operator Combine Item and Location columns from Sales Table Order by 1
  • Exists and Not Exists Operator in Sub Query

  • Exists and Not Exists Operator
  • TSQL

  • Cursor
  • Stored Procedure
  • Constraints in Sequel Server
  • Triggers in Sequel Server
  • System Data in SQL

  • User Name
  • System Name
  • DB Name
  •  

     

  • SQL Queries Examples
  •