Vous êtes sur la page 1sur 16

MD.

SAIFUDDIN SALMAN
3069
RDBMS

1. FUNCTIONS IN SQL
The different functions in SQL are:
1. Data functions.
2. Numeric functions (or) Number functions.
3. Aggregate functions.
4. Character functions.
5. Aggregate (or) Conversion functions.

1. DATA FUNCTIONS

Sl.No: FUNCTION DESCRIPTION


1 ROUN (Date) It rounds the specific portion of a date.

2 TRUNC (Date) It truncates the specific portion of a particular


date.
3 ADD-MONTHS (Date, Number)
Adds or subtracts number of months from a
4 MONTHS-BETWEEN (Date1, date.
Date2)
It gives the different between the dates in the
5 LAST-DAY (Date) months.

It return’s the date of the last day of the month


6 NEXT-DAY (Day time) of the given date.

It return’s the date of the day time of the week


after the given date.
MD. SAIFUDDIN SALMAN
3069
RDBMS

2. NUMERIC FUNCTIONS (OR) NUMBER FUNCTIONS

Sl.No: FUNCTION DESCRIPTION


1 ABS(n) This function is called as the absolute function. It
returns the absolute value of n.

2 MOD (m,n) It is called as modules function. It returns the reminder


of m/n.

3 POWER (m,n) It is called the power function. It returns mⁿ.

4 Round(n,m) This is used to round the value say ‘n’ is rounded to ‘m’
places.

5 TRUNC(n) It is used to truncate the given value, ‘n’ is truncated to


‘m’ places.

6 SQRT(n) It mean’s square root and it is used to calculate the


square root of a given number.

3. CHARACTER FUNCTIONS

Sl.No: FUNCTION DESCRIPTION


1 INIRCAP (Char) It accepts the character’s with in the
parenthesis and converts the character’s first
letter in initials (Capital’s) (Upper case).

2 LOWER (Char) Here, the character or the string is converted


into lower case.

3 UPPER (Char) The string is converted into upper case.

4 LTRIM (Char[set]) It is called as left trim and it removes the


character from the left side.

5 RTRIM (Char[set]) It is called as right trim and it removes the


character from the right side.

6 SUBSTR (Char,m[A]) It is called as sub-string and it is used to get a


particular sub-string. Here, m and n are
positions.
7 LENGTH (Char)
It finds the length of characters.
MD. SAIFUDDIN SALMAN
3069
RDBMS

4. CONVERSION FUNCTIONS

Sl.No: FUNCTION DESCRIPTION


1 TO-CHAR (Number) This function is used to convert the number
into character.

2 TO-NUMBER (Char) It converts the character into number.

3 TO-CHAR (Date, ’picture’) It converts the date function into character


function.

4 TO-DATE (String, ‘picture’) It converts the character date into the date
formed.

5. AGGREFATE FUNCTIONS (OR) CONVERSION FUNCTIONS

Sl.No: FUNCTION DESCRIPTION


1 AUG ([DISTINCT/ALL/X]) It calculates the average of ‘X’.

2 MAX ([DISTINCT/ALL/X]) It calculates the maximum value of ‘X’.

3 MIN ([DISTINCT/ALL/X]) It calculates the minimum value of ‘X’.

4 SUM ([DISTINCT/ALL/X]) It calculates the sum of values of ‘X’.

5 VARIANCE ([DISTINCT/ALL/X]) It calculates the variance of ‘X’.


MD. SAIFUDDIN SALMAN
3069
RDBMS

2. SYSTEM DEVELOPMENT LIFE CYCLE (SDLC)

INDRODUCTION:
Software is the set of instructions that when executed provide desired function and
performance.

The SDLC MODEL can be mainly classified in the following forms:


1. Problem definition.
2. Feasibility study.
3. System analysis.
4. System design.
5. Detailed design.
6. Implementation.
7. Maintenance.

PROBLEM DEFINITION

FEASIBILITY STUDY

SYSTEM ANALYSIS

SYSTEM DESIGN

DETAILED DESIGN

IMPLEMENTATION
________________________________
MAINTENANCE

1. Problem definition: In general the development process starts with defining


the problems. In this case the problems of the current system are examined and
they are evaluated in such a case that they can be understood.
2. Feasibility study: In this case the development of all the requirements,
objective analysis alternative design options technical and economical feasibility
of each alternative, protected schedule and cost estimation is made. This is done
MD. SAIFUDDIN SALMAN
3069
RDBMS

by the BDP (Business development people) or (Business analyst people). They


prepare BRS document after gathering requirement from the client.

3. System analysis: After preparing the BRS document, the system analyst people
study. The current system, the procedures that are to be followed information
flow, and method of work that is organized and control this analysis they,
prepare logical model of the system.
4. System design: After completion of analysis documents, the designees (system
architect) develops the objectives for the purpose system the logical objects like
design model, logical definition and data dictionary is defined for the purpose
system. And alternative design option is also develop.
It is elves able to develop a cost benefited analysis to evaluate the
economic implication of each alternative.
5. Detailed design: The physical construction of the software such as report
design, file design, Input design and Forms design are made here. The build is
being validated with respect to customer requirements and expectation. The test
schedule and expectation. The test schedule and implementation schedule is
developed.
6. Implementation: During implementation process the source code is produced.
The source code must be validated to ensure that it satisfies requirements
specification and it must be verify relative to design constraints. Test data is
generated during the execution of the resulting source code.
MD. SAIFUDDIN SALMAN
3069
RDBMS

3. Create the following tables and insert the values

I. Create a Location table


CREATE TABLE LOCATIOON
(LOCATION-ID NUMBER (4) NOT NULL,
REGION CHAR (10));

LOCATION
LOCATION-ID REGION

To insert values in to location table

INSERT INTO LOCATION (122, “NEW YORK” );


INSERT INTO LOCATION (123, “DALLAS”);
INSERT INTO LOCATION (14, “CHICAGO”);
INSERT INTO LOCATION (167, “BOSTON”);

LOCATION
LOCATION-ID REGION
122 NEW YORK
123 DALLAS
124 CHICAGO
167 BOSTON
MD. SAIFUDDIN SALMAN
3069
RDBMS

II. To create a DEPARTMENT table.


CREATE TABLE DEAPARTMENT
(DEPARTMENT-ID NUMBER (3) NOT NULL,
NAME CHAR (15),
LOCATION-ID NUMBER (4));

DEPARTMENT
DEPARTMENT-ID NAME LOCATION-ID

To insert values into DEPARTMENT table

INSERT INTO DEPARTMENT (10, “ACCOUNTING”, 122);


INSERT INTO DEPARTMENT (20, “RESEARCH”, 124);
INSERT INTO DEPARTMENT (30, “SALES”, 123);
INSERT INTO DEPARTMENT (40, “OPERATION”, 167);

DEPARTMENT
DEPARTMENT-ID NAME LOCATION-ID
10 ACCOUNTING 122
20 RESEARCH 124
30 SALES 123
40 OPERATIONS 167
MD. SAIFUDDIN SALMAN
3069
RDBMS

III. To Create JOB table.


CREATE TABLE JOB
(JOB-ID NUMBER (4) NOT NULL,
FUNCTION CHAR (15)),

JOB
JOB-ID FUNCTION

To insert values into JOB table


INSERT INTO JOB (667, “CLERK”);
INSERT INTO JOB (668, “STAFF”);
INSERT INTO JOB (669, “ANALYST”);
INSERT INTO JOB (670, “SALESMAN”);
INSERT INTO JOB (671, “MANAGER”);
INSERT INTO JOB (672, “PRESIDENT”);

JOB
JOB-ID FUNCTION
667 CLERK
668 STAFF
669 ANALYST
670 SALESMAN
671 MANAGER
672 PRESIDENT
MD. SAIFUDDIN SALMAN
3069
RDBMS

IV. To create an EMPLOYEE table.


CREATE TABLE EMPLOYEE
(EMPLOYEE-ID NUMBER (4),
LAST-NAME CHAR (10),
FIRST NAME CHAR (10),
MIDDLE NAME CHAR (2),
JOB-ID NUMBER (3),
MANAGER-ID NUMBER (4),
HIRE-DATE DATE ( ),
SALARY NUMBER (5),
COMMISSION NUMBER (5),
DEPARTMENT-ID NUMBER (3));

EMPLOYEE LAST FIRST MIDDLE JOD MANAGER HIRE SALARY COMMISION DEPARTMENT
ID NAME NAME NAME ID ID DATE
MD. SAIFUDDIN SALMAN
3069
RDBMS

To insert value into Employee table:


INSERT INTO EMPLOYEE (7369, “SMITH”, “JOHN”,”Q”, 667, 7902, 17-DEC-85, 800,
“NULL”, 20);
INSERT INTO EMPLOYEE (7499, “ALLEN”, “KEVIN”, “J”, 670, 7698, 20-FEB-85, 1600,
300, 30);
INSERT INTO EMPLOYEE (7505, “DOYLE”, “JEAN”, “K”, 671, 7838, 04-APR-85, 2850,
“NULL”, 30):
INSERT INTO EMPLOYEE (7506, “DENNIS”, “LYNN”, “S”, 671, 7839, 15-MAY-85, 2750,
“NULL”, 30);
INSERT INTO EMPLOYEE (7507, “BAKER”, “LESLIE”, “D”, 671, 7839, 10-JUN-85, 2200,
“NULL”, 40);
INSERT INTO EMPLOYEE (7521, “WARK”’ “CYNTHIA”’ “D”, 670, 7698, 22-FEB-85,
1250, 500, 30);

EMPLOYEE LAST FIRST MIDDLE JOD MANAGER HIRE- SALARY COMMISION DEPARTMENT-
ID NAME NAME NAME ID ID DATE ID
7369 SMITH JOHN Q 667 7902 17-DEC-85 800 NULL 20

7499 ALLEN KEVIN J 670 7698 20-FEB-85 1600 300 30

7505 DOYLEE JEAN K 671 7839 04-APR-85 2850 NULL 30

7506 DENNIS LYNN S 671 7839 15-MAY-85 2750 NULL 30

7507 BAKER LESLIE D 671 7839 10-JUN-85 2200 NULL 40

7521 WARK CYNTHA D 670 7698 22-FEB-85 1250 500 30

4. List out all the employee details. [Describe Employee table].


DESCRIBE EMPLOYEE

FIELD NAME FIELD TYPE


EMPLOYEE – Id NUMBER NOT NULL
MD. SAIFUDDIN SALMAN
3069
RDBMS

LAST – NAME CHAR


FIRST – NAME CHAR
MIDDLE – NAME CHAR
JOB – Id NUMBER
MANAGER – Id NUMBER
HIRE – DATE DATE
SALARY NUMBER
COMMISSION NUMBER
DEPARTMENT - Id NUMBER

5. Describe Department table.

DESCRIBE DEPARTMENT

FIELD NAME FIELD TYPE


DEPARTMENT Id NUMBER NOT NULL
NAME CHAR
LOCATION - Id NUMBER

6. Describe JOB table.

DESCRIBE JOB

FIELD NAME FIELD TYPE


JOB – Id NUMBER NOT NULL
FUNCTION CHAR

7. Describe LOCATION table.

DESCRIBE LOCATION

FIELD NAME FIELD TYPE


LOCATION – Id NUMBER NOT NULL
REGION CHAR
MD. SAIFUDDIN SALMAN
3069
RDBMS

FROEBEL’S VOCATIONAL JUNIOR COLLEGE


RED HILLS, HYDERABAD

DEPARTMENT OF COMPUTER SCIENCE

CERTIFICATE

This is to certify project work entitled

………………………………………………………………………………………

is the bonifide work of

Mr./Miss.…………………………………………………………………………....

Hall ticket no………………………………..of 2008-2009 C.S.E IInd Year along

with his/her batch mates for the award of Computer Science and

Engineering by Board of Intermediate Education Andhra Pradesh and

training during the academic session 2008-2009.

Internal Principal
MD. SAIFUDDIN SALMAN
3069
RDBMS

INDEX
S. NO: CONTEXT PAGE NO:
1. Function in SQL

2. System development life cycle (SDLC)

3. Create the following tables and insert the


values

4. List out all the employee detail. [Describe


employee table].

5. Describe DEPARTMENT table.

6. Describe JOB table.

7. Describe LOCATION table.

External Examiner
MD. SAIFUDDIN SALMAN
3069
RDBMS

QUESTIONS

1. Function in SQL.

2. System development life cycle.

3. I . Create the following tables and insert the values

LOCATION
LOCATION-ID REGION
MD. SAIFUDDIN SALMAN
3069
RDBMS

122 NEW YORK


123 DALLAS
124 CHICAGO
167 BOSTON

II. To create a DEPARTMENT table.

DEPARTMENT
DEPARTMENT-ID NAME LOCATION-ID
10 ACCOUNTING 122
20 RESEARCH 124
30 SALES 123
40 OPERATIONS 167

III. To Create JOB table.

JOB
JOB-ID FUNCTION
667 CLERK
668 STAFF
669 ANALYST
670 SALESMAN
671 MANAGER
672 PRESIDENT

IV. To create an EMPLOYEE table.


MD. SAIFUDDIN SALMAN
3069
RDBMS
EMPLOYEE LAST FIRST MIDDLE JOD MANAGER HIRE- SALARY COMMISION DEPARTMENT-ID
ID NAME NAME NAME ID ID DATE
7369 SMITH JOHN Q 667 7902 17-DEC-85 800 NULL 20

7499 ALLEN KEVIN J 670 7698 20-FEB-85 1600 300 30

7505 DOYLEE JEAN K 671 7839 04-APR-85 2850 NULL 30

7506 DENNIS LYNN S 671 7839 15-MAY-85 2750 NULL 30

7507 BAKER LESLIE D 671 7839 10-JUN-85 2200 NULL 40

7521 WARK CYNTHA D 670 7698 22-FEB-85 1250 500 30

4. List out all the employee details. [Describe Employee table].

5. Describe Department table.

6. Describe JOB table.

7. Describe LOCATION table.

Vous aimerez peut-être aussi