This book would be a kind of helping hand towards developing a good database design application. A properly designed database can be expanded to meet the challenges of any situation,which is possible if and only if you have mastered STRUCTURAL QUERY LANGUAGE(SQL).
Its' well known fact that SQL is a very powerful , query language - a must for all types of persons related to Business, Education,Management - and without it , a strong database application cann't be developed.
SQL is the basic language used to manipulate and retrieve data from the oracle.
It comprises of Data Definition Language(DDL),Data Manipulation Language(DML),Data Control Language(DCL).
SQL is a non-procedural language and it does not support and not have programmatic constructs such as loop structure.
PL/SQL is an oracle 's procedural language - extension of SQL.
Constraints on data
Constraints on data can be applied at the time of creation of tables in any database or provide control of data.
Check Integrity Constraint
It can be applied to any coulmn while applying integrity rules.
for example,
SQL>create table person
{
p_id varchar2(5) CONSTRAINT uk01 UNIQUE,
p_name varchar2(5),
p_age number(3) CONSTRAINT chk01 CHECK (p_age >=20);
};
Unique key Constraint
It can be applied to any coulmn while identifying each record in the same coulmn uniquely.
for example,
SQL>create table person
{
p_id varchar2(5) CONSTRAINT uk01 UNIQUE,
p_name varchar2(5),
p_age number(3);
};
Primary key Constraint
It can be applied to one or more coulmns of a table while identifying each row uniquely.
When applied to more than one coulmns , it is called as composite primary key.
Please refer to chapter 4.
........
we have already created a table named teacher,altered it to add primary key constraint,inserted data to it - in the same way,we are going to create,insert datas into tables named student and detail table teacher_student while altering to add primary key(student) as well as foriegn keys (teacher_student) respectively .
//creation of the table student
SQL>create table student
{
s_id varchar2(5),
s_name varchar2(5),
s_age number(3);
};
//adding primary key constraint to the table student
SQL>alter table student
add
constraint pk02 primary key(s_id);
//now inserting data into table student
SQL>insert into student
values
('soo1','manoj verma',18);
1 row inserted.
SQL>insert into student
values
('soo2','reena arora',19);
SQL>select * from teacher;
....
ROUND
SQL>select ROUND(4.123,2) "result" from dual; // rounding 4.123 upto 2 places
result
4.12
SQRT
SQL>select SQRT(16) "result" from dual; // square root of 16
result
4
LOWER
SQL>select LOWER('RAJEEV KUMAR') "result" from dual; //lower case of RAJEEV KUMAR
result
rajeev kumar
UPPER
SQL>select UPPER('rajeev kumar') "result" from dual;//upper case of RAJEEV KUMAR
result
RAJEEV KUMAR
LTRIM
SQL>select LTRIM('aaaarajeevbbbkumarcccc','a') "result" from dual; //remove character until //new character from left
result
rajeevbbbkumarcccc
RTRIM
SQL>select RTRIM('aaaarajeevbbbkumarcccc','c') "result" from dual; //remove character until //new character from right
result
aaaarajeevbbbkumar
.....
View can be used for data manipulation - all the operations on data such as updation,deletion etc.
while using views, data representation be made or done from more than one table.
Query fired on view runs faster as compared to base table.
Limitations
Distinct,Group by or Having by clause not allowed
Aggregate functions not allowed
.........
SQL is used at every step of application developent - Its' a heart for any database design and therefore, application development.
if database design is strong , an application based on it will be running flexible.
If database design is weak, building an application will be harder and time consuming.
I'm rajeev kumar 49 years from ind
Its' well known fact that SQL is a very powerful , query language - a must for all types of persons related to Business, Education,Management - and without it , a strong database application cann't be developed.
SQL is the basic language used to manipulate and retrieve data from the oracle.
It comprises of Data Definition Language(DDL),Data Manipulation Language(DML),Data Control Language(DCL).
SQL is a non-procedural language and it does not support and not have programmatic constructs such as loop structure.
PL/SQL is an oracle 's procedural language - extension of SQL.
Constraints on data
Constraints on data can be applied at the time of creation of tables in any database or provide control of data.
Check Integrity Constraint
It can be applied to any coulmn while applying integrity rules.
for example,
SQL>create table person
{
p_id varchar2(5) CONSTRAINT uk01 UNIQUE,
p_name varchar2(5),
p_age number(3) CONSTRAINT chk01 CHECK (p_age >=20);
};
Unique key Constraint
It can be applied to any coulmn while identifying each record in the same coulmn uniquely.
for example,
SQL>create table person
{
p_id varchar2(5) CONSTRAINT uk01 UNIQUE,
p_name varchar2(5),
p_age number(3);
};
Primary key Constraint
It can be applied to one or more coulmns of a table while identifying each row uniquely.
When applied to more than one coulmns , it is called as composite primary key.
Please refer to chapter 4.
........
we have already created a table named teacher,altered it to add primary key constraint,inserted data to it - in the same way,we are going to create,insert datas into tables named student and detail table teacher_student while altering to add primary key(student) as well as foriegn keys (teacher_student) respectively .
//creation of the table student
SQL>create table student
{
s_id varchar2(5),
s_name varchar2(5),
s_age number(3);
};
//adding primary key constraint to the table student
SQL>alter table student
add
constraint pk02 primary key(s_id);
//now inserting data into table student
SQL>insert into student
values
('soo1','manoj verma',18);
1 row inserted.
SQL>insert into student
values
('soo2','reena arora',19);
SQL>select * from teacher;
....
ROUND
SQL>select ROUND(4.123,2) "result" from dual; // rounding 4.123 upto 2 places
result
4.12
SQRT
SQL>select SQRT(16) "result" from dual; // square root of 16
result
4
LOWER
SQL>select LOWER('RAJEEV KUMAR') "result" from dual; //lower case of RAJEEV KUMAR
result
rajeev kumar
UPPER
SQL>select UPPER('rajeev kumar') "result" from dual;//upper case of RAJEEV KUMAR
result
RAJEEV KUMAR
LTRIM
SQL>select LTRIM('aaaarajeevbbbkumarcccc','a') "result" from dual; //remove character until //new character from left
result
rajeevbbbkumarcccc
RTRIM
SQL>select RTRIM('aaaarajeevbbbkumarcccc','c') "result" from dual; //remove character until //new character from right
result
aaaarajeevbbbkumar
.....
View can be used for data manipulation - all the operations on data such as updation,deletion etc.
while using views, data representation be made or done from more than one table.
Query fired on view runs faster as compared to base table.
Limitations
Distinct,Group by or Having by clause not allowed
Aggregate functions not allowed
.........
SQL is used at every step of application developent - Its' a heart for any database design and therefore, application development.
if database design is strong , an application based on it will be running flexible.
If database design is weak, building an application will be harder and time consuming.
I'm rajeev kumar 49 years from ind