Understanding Common SQL statements

The commonly used SQL statements are: 1): Select 2): Insert 3): Update 4): Delete


 

Ads

Tutorials   
JDBC Video Tutorial: Create, Read, Update and Delete (CRUD) Operation examples JDBC Video tutorial - How to read Data from MySQL Database? JDBC Video tutorial - How to delete Data in a MySQL Database? Solving java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception JDBC Video tutorial - How to update Data in a MySQL Database? JDBC Video Tutorial- How to insert data into MySQL database table? JDBC Video Tutorial: How to download JDBC Driver for MySQL? JDBC Tutorial - Writing first JDBC example and running in Eclipse Java Cross Join MySQL Database Connectivity Example In Java Change Column Name in MySQL Java Mysql Connection Example JDBC ODBC Connection In Java ResultSet In Java Prepared Statement Example JdbcRowSet interface Java JdbcRowSet Example First Step towards JDBC! JDBC Training, Learn JDBC yourself Jdbc Get Column Names JDBC Example with MySQL JDBC Prepared Statement Update JDBC Prepared Statement Insert JDBC Prepared Statement Example JDBC Prepared statement Close JDBC Prepared Statement Addbatch JDBC Nested Resultset JDBC-Odbc Connection JDBC-Odbc Connectivity JDBC Insert Preparedstatement JDBC Insert Null JDBC Get Metadata JDBC Insert Record Jdbc Insert Statement JDBC Meta Data Get tables Jdbc Mysql Connection String Jdbc Mysql Connection Url JDBC Next Jdbc Get Connection JDBC Get Int JDBC Exception JDBC Get Row Count JDBC Functions JDBC Fetch JDBC Execute Update Example JDBC Execute Statement JDBC Execute Query JDBC Drive For Mysql JDBC Connectivity Code In Java JDBC connection timeout
Ads

Understanding Common SQL statements

     

The commonly used SQL statements are:

1): Select
2): Insert
3): Update
4): Delete

SQL Select statement:

The SELECT statement is used to select data from a table.

Syntax: Select column_names FROM table_name;

The result from a SQL query is stored in a resultset. The SELECT statement has mainly three clauses.

1). Select
2.) From
3). Where

The Select specifies the table columns that are retrieved. The From clause tells from where the tables has been accessed. The Where clause specifies which tables are used. The Where clause is optional, if not used then all the table rows will be selected.

We can see that we have used semicolon at the end of the select statement. It is used to separate each SQL statement in database systems which helps us to execute more than one SQL statement in the same call to the server.

SQL INSERT Statement:

This statement allows you to insert a single or multiple records into the database. We can specify the name of the column in which we want to insert the data.

Syntax: Insert into table_name values (value1, value2..);

The Insert statement has mainly three clauses.

1). Insert: It specifies which table column has to be inserted in the table.
2). Into : It tells in which the data will be stored.
3). Values: In this we insert the values we have to insert.

We can also specify the columns for which we want to insert data.

The UPDATE Statement:

The Update statement is used to modify the data in the table. Whenever we want to update or delete a row then we use the Update statement.

The syntax is :

UPDATE table_name Set colunm_name = new_value WHERE column_name = some_name;

The Update statement has mainly three clauses.

1). UPDATE: It specifies which table column has to be updated.
2). Set: It sets the column in which the data has to be updated.
3). Where: It tells which tables are used.

SQL DELETE Statement:

This delete statement is used to delete rows in a table.

Systax:

DELETE FROM table_name WHERE column_name = some_name;

The Delete statement has following clauses.

1). Delete: It specifies which table column has to be deleted.
2). From: It tells from where the Table has been accessed.
3). Where: It tells which tables are used.

 


Advertisements

Share on Google+Share on Google+

Understanding Common SQL statements

Posted on: April 13, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Understanding Common SQL statements   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads