Thursday, October 1, 2020

SQl - Standard Query Language

 

  

    What do you mean by SQL   ?  

     SQL ore standard query language which is used to perform the basic CRUD

     function of managing a database like creating, updating, retreiving and deleting.

    Requirements fro running SQL :

     Basically we use SQL in building websites backend for fetching data from the 

     database. so we need the following technologies :

       1. We need a database program where we can run our queries like

             Ms Access, MySQL, Oracle.

       2.For styling of the website we need HTML/ CSS

       3. We need server side scripting Languages like PHP 


   So before Jumping to SQL we need to have brief  snapshot of what exactly is

   Database Management System:

   well as the name suggest that it is a platform where we can manage our data in

   flexible, reliable and error free manner. Basically Database is nothing but a table

   which contains data in the form of row and columns; lets visualize the components

   of database through a diagram.

  Let us see some basic SQL Statements used in Database:

    1. Select Query:

        Syntax 1: Select column1, column2, column3 from tablename;

        Function: The Select statement as the name suggests is used to select data according

                          to the specified criteria such as columns

    

  2.   Syntax 2: Select * from  tablename;

        Function: This query is used to fetch all the records from the table which are fed.

 

3.  Syntax 3: Select Distinct Column1, Column 2, Column 3  from tablename;

     Function: In order to fetch only different values  from the tables this statement

                       is used. In this query the basic objective is that to reduce same values

                      from appearing twice.


4.Syntax 4: Select Column1, Column2, Column3 from tablename where  condition;

Function: The where clause is used to filter records according to specified condition


5. Syntax 5: Select Column1, Column2, Column3 from tablename where

                     condition1 and condition2 and condition3;

Function: The And keyword used with where enable to filter data from database 

                  if all the conditions are true.


6. Syntax 6: Select Column1, Column2, Column3 from tablename where

                     condition1 or condition2 or condition3;

Function: The And keyword used with where enable to filter data from database 

                  if all the any one of the conditions are true.


7. Syntax 7:Select Column1, Column2,Column3 from tablename where NOT

                   Condition;

Function: The Not keyword is used to filter record from database excluding the

                   condition which is given in where clause.

 

8.Syntax 8:Select Column1, Column2, Column3 from tablename orderby columnname;

Function: The order by clause helps to display data from database according to ascending 

                 order or descending order alphabetically. By default the data is displayed in

                 ascending order. the keywords used to display in ascending is ASC and the

                 keyword used to display data in descending in DESC 




                   




 

 

 

  

  

 


   

No comments:

Post a Comment