Tuesday, October 30, 2012

Updating Records

The update statement is used to update or change records that match a specified criteria. This is accomplished by carefully constructing a where clause.

update "tablename"
set "columnname" = "newvalue" where "columnname" OPERATOR "value"
                                                 [and|or "column"
                                                    OPERATOR "value"];


Example:

1.
update "school"

set  name="rakesh" where number=2

2.
update "school"

set name="rakesh" where number=2 and lastname="reddy"


Monday, October 22, 2012

Insert Data into a Table

To insert records into a table, We use  key words insert into


insert into "tablename"  (first_column,...last_column)
  values (first_value,...last_value);

How TO Create Tables

Here is the format of a simple create table statement:


create table "tablename" ("column1" "data type", "column2" "data type",
 "column3" "data type");

Example:

1. create table "student" ("Name" "varchar(15)", "Class" "varchar(10)", "Roll No" "number(5)")

What is SQL?

SQL  stands for Structured Query Language.SQL is used to communicate with a database.Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc.the standard SQL commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish almost everything that one needs to do with a database.