You are on page 1of 7

G. V.

ACHARYA POLYTECHNIC
VEERACHARYA TECHNICAL EDUCATION CAMPUS, OPP.SHELU SUBURBAN RAILWAY STATION,
SHELU/DAMAT, TAL. KARJAT, DIST. RAIGAD, PIN-410201.

A PROJECT REPORT ON
SQL SYNTAX

SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE


AWARD OF

DIPLOMA IN
COMPUTER

SUBMITTED TO

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION, MUMBAI


SUBMITTED BY

Name of Student(s) (Full Name) Enrolment No.

1.SUMIT SHUKLA 4111440166 2.KUNAL

MHATRE 4111440069 3.SANIKA MANDLIK

4111440096 4.SIDDHESH MHATRE 4111440097

GUIDED BY
MRS. DEVYANI GIRASEY

1
INDEX

SR.NO CONTENT PAGE.NO


1. INTRODUCTION
2. QUERYING DATA FROM A TABLE
3. QUERYING FROM MULTIPLE TABLES
4. USING SQL OPERATORS
5. MANAGING TABLES
6. USING SQL CONSTRAINTS
8. MODIFYING DATA
9. MANAGING VIEWS
10. MANAGING INDEXES
11. SQL AGGREGATE FUNCTIONS
12. MANAGING TRIGGERS

INTRODUCTION

2
A database management system (DBMS) refers to the technology for
creating and managing databases. Basically DBMS is a software tool to
organize (create, retrieve, update and manage) data in a database.

The main aim of a DBMS is to supply a way to store up and retrieve


database information that is both convenient and efficient. By data, we
mean known facts that can be recorded and that have embedded meaning
Normally people use software such as

DBASE IV or V, Microsoft ACCESS, or EXCEL to store data in the form


of database Database systems are meant to handle large collection of
information Management of data involves both defining structures for
storage of information and providing mechanisms that can do the
manipulation of those stored information. Moreover, the database system
must ensure the safety of the information stored, despite system crashes or
attempts at unauthorized access.

This project is aim at computerizing the manual process of wedding


system. Front end and backend are implemented using HTML and MySQL
respectively. Along with the JSP program to analyse the program. The
project consists of seven forms(entity) namely Planner who will plan for the
wedding. The form Planner will have number of staffs. As well as each staff
will maintains the guests and staffs are belongs to particular department.
The weddings are held at Venue

1.QUERYING DATA FROM A TABLE

SELECT c1, c2 FROM t;

Query data in columns c1, c2 from a table

3
SELECT * FROM t;

Query all rows and columns from a table

SELECT c1, c2 FROM t


WHERE condition;

Query data and filter rows with a condition

SELECT DISTINCT c1 FROM t


WHERE condition;

Query distinct rows from a table

SELECT c1, c2 FROM t


ORDER BY c1 ASC [DESC];
Sort the result set in ascending or descending order

SELECT c1, c2 FROM t


ORDER BY c1
LIMIT n OFFSET offset;
Skip offset of rows and return the next n rows

SELECT c1, aggregate(c2)


FROM t
GROUP BY c1;
Group rows using an aggregate function

2.QUERYING FROM MULTIPLE TABLES

SELECT c1, c2
FROM t1
INNER JOIN t2 ON condition;
Inner join t1 and t2

4
SELECT c1, c2
FROM t1
LEFT JOIN t2 ON condition;
Left join t1 and t1

SELECT c1, c2
FROM t1
RIGHT JOIN t2 ON condition;
Right join t1 and t2

SELECT c1, c2
FROM t1
FULL OUTER JOIN t2 ON condition;
Perform full outer join

SELECT c1, c2
FROM t1
CROSS JOIN t2;
Produce a Cartesian product of rows in tables

SELECT c1, c2
FROM t1, t2;
Another way to perform cross join

3.USING SQL OPERATORS

SELECT c1, c2 FROM t1


UNION [ALL]
SELECT c1, c2 FROM t2;
Combine rows from two queries

SELECT c1, c2 FROM t1


INTERSECT
SELECT c1, c2 FROM t2;
Return the intersection of two queries

SELECT c1, c2 FROM t1

5
MINUS
SELECT c1, c2 FROM t2;
Subtract a result set from another result set

SELECT c1, c2 FROM t1


WHERE c1 [NOT] LIKE pattern;
Query rows using pattern matching %, _

SELECT c1, c2 FROM t


WHERE c1 [NOT] IN value_list;
Query rows in a list

SELECT c1, c2 FROM t


WHERE c1 BETWEEN low AND high;
Query rows between two values

SELECT c1, c2 FROM t


WHERE c1 IS [NOT] NULL;
Check if values in a table is NULL or no

4.MANAGING TABLES

CREATE TABLE t (
id INT PRIMARY KEY,
name VARCHAR NOT NULL,
price INT DEFAULT 0);
Create a new table with three column

DROP TABLE t ;
Delete the table from the database

ALTER TABLE t ADD column;


Add a new column to the table

ALTER TABLE t DROP COLUMN c ;


Drop column c from the table

ALTER TABLE t ADD constraint;

6
Add a constraint

ALTER TABLE t DROP constraint;


Drop a constraint

ALTER TABLE t DROP t2;


Rename a table from t1 to t2

ALTER TABLE t1 RENAME c1 TO c2 ;


Rename column c1 to c2

TRUNCATE TABLE t;
Remove all data in a table

5.USING SQL CONSTRAINTS

You might also like