Basic SQL Queries

Akshay Patel, Kamal Rawat

This book discusses the Basic SQL Queries.

  • Published on Nov 26 2014
  • Pages 43
  • Downloaded 10.6k
  • Type PDF

Table of Content

  1. Environment Setup

  2. SQL Queries

    2.1 Get all columns and all rows from table
    2.2 Get desired columns and all rows from table
    2.3 Get all columns from table where column name is equal to xxx
    2.4 Get all columns from table where column name between xxx and xxx
    2.5 Get all rows from table where column name is aaa,bbb,xxx
    2.6 Get all rows from table where column name starts with 'x' letter
    2.7 Get all rows from table where column name ends with 'x' letter
    2.8 Get all rows from table where column name starts with 'x/z' letter
    2.9 Get all rows from table where column name does not start with 'x/z' letter
    2.10 Get single column with a combination of two columns and all rows from table
    2.11 Get all rows from table where column name is not containing null values
    2.12 Get all rows from table in descending order of column name
    2.13 Get all rows from table in ascending order of column name
    2.14 Get unique rows from table based on column name
    2.15 Get top 5 rows from table name
    2.16 Get maximum column value from table by column name
    2.17 Get maximum column value from table by column name using COMPUTE
    2.18 Get even row from table 'Product'
    2.19 Get odd row from table 'Product'
    2.20 Count number of records in a 'Product' table
    2.21 List all the categories with products (Inner Join)
    2.22 List all rows from category, with products (Left Join)
    2.23 List all the rows from products (Right Join)
    2.24 List all the rows from the category table and product table (Full Join)
    2.25 Get average value of price from product table
    2.26 Get number of products from product table
    2.27 Get Maximum price of product from product table
    2.28 Get minimum price of product from product table
    2.29 Get total number of qty of products from product table
    2.30 Get all product name is in upper case from product table
    2.31 Get all product name is in lower case from product table
    2.32 List all columns of all tables in a database
    2.33 List all tables which have column name like 'CategoryId'
    2.34 List number of records in each table in a database
    2.35 List all tables in a database
    2.36 List all procedures from a database
    2.37 List all tables in all databases
    2.38 List all Stored Procedures in All Databases
    2.39 List sizes of all tables in a database
    2.40 List sizes of all database files
    2.41 Generate xsd of a table without data
    2.42 Generate xsd of a table with data