No announcement yet.

Some useful SQL commands


Ads on showthread pages

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

  • Some useful SQL commands

    WordPress Hosting on SSD Servers
    Selecting values from the database table

    Select query is used to select data from database table. The syntax is below:
    Syntax:- Select column_name from table_name.
    Use distinct keyword if you want to return only distinct (not common) values.
    Syntax:- select distinct column_name from table_name
    Sorting Rows:

    Order by clause is used to return result in sorted way. For example:

    Select column_name from table_name order by column_name

    Inner Join, Left Join, Right Join, Union Join

    Inner Join:
    Return all the rows matching in both the tables.

    Left Join:
    Return all the rows of first table even if they are not matching with second table.

    Right Join:
    Return all the rows of second table even if they are not matching with first table.

    To display information from two tables with same data type. Union ALL will display duplicate rows of two tables.

    Difference between truncate and delete:

    Truncate will remove all the data from a table but it will not delete the table itself.

    This statement is used to add or drop columns in an existing table.
    Last edited by admin; 08-18-2015, 06:38 AM.

  • #2
    ASP.Net Hosting starts @ $3.18/Mo.
    Re: Some useful SQL commands

    A SQL clause is the word or phrase that begins each SQL command statement and the single most important component to any SQL command. Looking at the clause of any given SQL command usually tells the SQL programmer what that particular command intends to do to the database. For instance, a SELECT command begins with the SELECT clause and any level of SQL programmer will recognize the SELECT query as a command selecting data from the database.

    Other SQL clauses include:

    * Add
    * Drop
    * Create
    * Insert
    * Select
    * Update
    * Replace
    * Delete


    Sign up for a News Letter Click here to sign up