dbms notes

 dbms remarks Essay

 INDEX

1 . SQL ESSENTIALS

The Structured Query Dialect (SQL) is known as a language that enables you to create and operate on relational databases, which are units of related information kept in tables.

The standard structure of a SQL manifestation consists of three clauses: Select

From

In which

SELECT: -- The choose clause is utilized to list the features desired in the result of a question. It corresponds to the output operation in the relational algebra.

FROM: - The coming from clause data the relation to be sought in the evaluation of the phrase. It match the Cartesian product operation of the relational algebra.

EXACTLY WHERE: - The where clause consists of a predicate involving advantages of the contact that appear in the via clause.

A STANDARD SQL QUESTION HAS THE CONTACT FORM: -

Select A1, A2………, An

via r1, r2………..., rm

wherever P

Here,

Every Ai presents to an feature.

Every single ri represents a regards.

P is the predicate.

2 . PROGRAM TO CREATE TABLE

SYNTAX:

CREATE TABLE

( (), ());

Create the table described under:

Table Identity: CLIENT_MASTER

LINE NAME

DATA TYPE

SIZE

CLIENTNO

VARCHAR2

6

IDENTITY

VARCHAR2

twenty

CITY

VARCHAR2

15

PINCODE

NUMBER

eight

STATE

VARCHAR2

15

BALANCEDUE

NUMBER

15

SQL> CREATE TABLE CLIENT_MASTER

2 ( CLIENTNO VARCHAR2(6),

3 BRAND VARCHAR2(20),

5 CITY VARCHAR2(15),

5 PINCODE NUMBER(6),

six STATE VARCHAR2(10),

7 BALANCEDUE NUMBER(10));

Stand created.

SQL> DESC CLIENT_MASTER;

Name Null? Type

----------------------------------------- -------- ---------------------------- CLIENTNO VARCHAR2(6) TERM VARCHAR2(20) TOWN VARCHAR2(15) PINCODE NUMBER(6) CONDITION VARCHAR2(10) BALANCEDUE NUMBER(10)

several. PROGRAM TO INSERT IDEALS

SYNTAX:

METHOD1

INSERT IN TABLENAME VALUES(‘& COLUMNAME', '& COLUMNAME');

METHOD2

INSERT IN TO TABLENAME VALUES(‘VALUE1', ' VALUE2');

METHOD3

PUT IN INTO TABLENAME(COLUMNAME1, COLUMNAME2) VALUES(‘VALUE1', ' VALUE2');

Insert the following data into CLIENT_MASTER

CLIENTNO

NAME

TOWN

PINCODE

CONDITION

BALANCEDUE

C0001

IVAN

MUMBAI

400054

MAHARASHTRA

15000

C0002

MAMTA

MADRASS

780001

TAMIL NADU

0

C0003

CHHAYA

MUMBAI

400057

MAHARASHTRA

5000

C0004

ASHWINI

BANGALORE

560001

KARNATKA

0

METHOD-1

SQL> INSERT IN TO CLIENT_MASTER VALUES(

2 '& CLIENTNO', '& NAME', '& CITY',

three or more '& PINCODE', '& STATE', '& BALANCEDUE');

Enter value for clientno: C1

Enter value intended for name: IVAN

Enter value for city: MUM

Enter into value pertaining to pincode: 400054

Enter value for point out: MH

Enter into value pertaining to balancedue: 15000

1 row created.

SQL> /

Enter in value pertaining to clientno: C2

Enter value for term: MAMTA

Enter value to get city: CHENNAI

Enter worth for pincode: 780001

Enter in value pertaining to state: TN

Enter worth for balancedue: 0

1 row developed.

OUTPUT:

SQL> SELECT 5. FROM CLIENT_MASTER;

CLIENT IDENTITY CITY PINCODE STATE BALANCEDUE ------ -------------------- --------------- ---------- ---------- ---------- -------- ----------------------- C1 IVAN MUM 400054 MH 15000 C2 MAMTA CHENNAI 780001 TN 0

METHOD-2

SQL> INSERT INTO CLIENT_MASTER VALUES('C3', 'CHHAYA', 'MUM', '400057', 'MH', '5000');

one particular row created.

OUTPUT:

SQL> SELECT * FROM CLIENT_MASTER;

CLIENT BRAND CITY PINCODE STATE BALANCEDUE ------ -------------------- --------------- ---------- ---------- ---------- --------...

References: SQL> MODIFY TABLE EMP

2 PUT CONSTRAINT S SALARY EXAMINE (SALARY > 1000);