Professional Documents
Culture Documents
OF
BBA - 307
[ INFORMATION SYSTEM MANAGEMENT ]
BACHELOR OF BUSINESS ADMINISTRATION
Academic Session – : 2023 – 24
Submitted by – Submitted to :
GURPREET Ms. Bharti Aggarwal
12921301721 Assistant Professor
TABLE OF CONTENTS
Sr.No List Of Programs Page No Faculty’s Sign
1. DDL commands
2. DATATYPES IN SQL
3. CREATE TABLE
EMPTIAS(EMP_ID,EMP_NAME,EMP_DEPT,DESIGNATIO
N,EMP_CONTACT,SALARY)
4. DROP COMMAND
5. ALTER COMMAND
6. TRUNCATE COMMAND
7. COMMENT COMMAND
8. RENAME COMMAND
9. DML COMMANDS
18. COMMITCOMMAND
2. ALTER COMMAND
ALTER is a DDL command which changes or modifies the existing structure of the
database, and it also changes the schema of database objects.
3. RENAME COMMAND
RENAME is a DDL command which is used to change the name of the database table.
OUTPUT
4. TRUNCATE COMMAND
TRUNCATE is DDL command which deletes or removes all the records from the table. This
command also removes the space allocated for storing the table records.
OUTPUT
5. DROP COMMAND
To delete the database from the SQL database. To do this, you have to use DROP COMMAND.
DATA TYPES IN SQL
An developer must be aware of what type of data will be stored inside each column
while creating a table. The data type guideline for SQL is to understand what type
of data is expected inside each column and it also identifies how SQL will interact
with the stored data.
For every database, data types are primarily classified into three categories.
o Numeric Datatypes
o Date and Time Database
o String Database
DROP COMMAND
ALTER COMMAND
OUTPUT
TRUNCATE COMMAND
OUTPUT
RENAME COMMAND
OUTPUT
DML COMMANDS
1. SELECT Command
2. INSERT Command
3. UPDATE Command
4. DELETE Command
SELECT is the most important data manipulation command in Structured Query Language. The
SELECT command shows the records of the specified table. It also shows the particular record of
a particular column by using the WHERE clause.
OUTPUT
INSERT is another most important data manipulation command in Structured Query Language,
which allows users to insert data in database tables.
OUTPUT
UPDATE is another most important data manipulation command in Structured Query Language,
which allows users to update or modify the existing data in database tables.
OUTPUT
DELETE is a DML command which allows SQL users to remove single or multiple existing
records from the database tables.
This command of Data Manipulation Language does not delete the stored data permanently from
the database. We use the WHERE clause with the DELETE command to select specific rows from
the table.
SELECT COMMAND
SELECT is the most important data manipulation command in Structured Query Language. The
SELECT command shows the records of the specified table. It also shows the particular record of
a particular column by using the WHERE clause.
This example shows all the values of every column from the table.
This example shows all the values of a specific column from the table.
This example describes how to use the WHERE clause with the SELECT DML command.
DCL COMMANDS
DCL Commands include commands such as GRANT and REVOKE which mainly deal
with the rights , permissions , and other controls of the database system
GRANT COMMAND
REVOKE COMMAND
TCL COMMANDS
Transactions group a set of tasks into a single execution unit. Each transaction begins with a
specific task and ends when all the tasks in the group are successfully completed. If any of the
tasks fail, the transaction fails. Therefore, a transaction has only two results: success or failure.
COMMIT COMMAND
ROLLBACK COMMAND
SAVEPOINT COMMAND
DATA CONSTRAINTS
SQL constraints are used to specify rules for the data in a table.
Constraints are used to limit the type of data that can go into a table. This ensures the accuracy and
reliability of the data in the table. If there is any violation between the constraint and the data
action, the action is aborted.
Constraints can be column level or table level. Column level constraints apply to a column, and
table level constraints apply to the whole table.
PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row
in a table
FOREIGN KEY - Prevents actions that would destroy links between tables
CREATE INDEX - Used to create and retrieve data from the database very quickly
PRIMARY KEY
FOREIGN KEY
UNIQUE KEY
OUTPUT
CHECK KEY
GROUP BY CLAUSE
ORDER BY CLAUSE
AGGREGATE FUNCTIONS
An aggregate function in SQL returns one value after calculating multiple values of a
column. We often use aggregate functions with the GROUP BY and HAVING clauses of
the SELECT statement.
Count()
Sum()
Avg()
Min()
Max()
Aggregate functions are a vital component of database management systems. They allow us to
perform calculations on large data sets quickly and efficiently. For example, these functions
generate statistical reports, perform financial analysis, and manage inventory levels.
In addition, we can better understand the data we are working with by using aggregate functions.
For example, we can easily calculate the average price of all products in our inventory or find the
total sales for a particular time. Without aggregate functions, we would need to manually sort
through each data point, which would be time-consuming and error-prone.
Overall, aggregate functions are essential for anyone working with large amounts of data and
seeking to gain valuable insights from it.
MAX
MIN
COUNT
SUM
AVERAGE
E-R MODEL
The Entity Relational Model is a model for identifying entities to be represented in the database
and representation of how those entities are related. The ER data model specifies enterprise
schema that represents the overall logical structure of a database graphically.
The Entity Relationship Diagram explains the relationship among the entities present in the
database. ER models are used to model real-world objects like a person, a car, or a company and
the relation between these real-world objects. In short, the ER Diagram is the structural format of
the database.
ER diagrams are used to represent the E-R model in a database, which makes them easy to be
converted into relations (tables).
ER diagrams provide the purpose of real-world modeling of objects which makes them intently
useful.
These diagrams are very easy to understand and easy to create even for a naive user.
Entity
An Entity may be an object with a physical existence – a particular person, car, house, or
employee – or it may be an object with a conceptual existence – a company, a job, or a university
course.
Attributes
Attributes are the properties that define the entity type. For example, Roll_No, Name, DOB,
Age, Address, and Mobile_No are the attributes that define entity type Student. In ER diagram,
the attribute is represented by an oval.
Relationship
Relationship Type represents the association between entity types. For example, ‘Enrolled in’ is
a relationship type that exists between entity type Student and Course. In ER diagram, the
relationship type is represented by a diamond and connecting the entities with lines
DATABASE DESIGN USING E-R MODEL
SAMPLE SYNTAX