Puja N Final
Puja N Final
Puja N Final
BBA-V
Batch (2021-2024)
Submitted To Submitted By
Ms. Gargi Charterjee Name: Pujan Mehta
(Assistant Professor) Enroll No: 07313701721
Class: BBA-V(M2)
• ID
• COURSE CODE
• COURSE NAME.
Enter 5 records.
To Understand Steps to create a database, save the database and
the construction open the database. Create a student database with
process of Data S1 as table containing the field names as SERIAL
L-8 Base and Table NO, ENROLLMENT NO, NAME, AGE and
with inserting
ADDRESS.
the records.
Insert at least 10 records using the design view in
MS ACCESS.
To Understand Define data type and explain the various data types 19/08
the concept of available in MS-ACCESS. Create a databaseDB1
Data Types & with a table T1 with the following fields as:
construction
process of Data • ST_NO.
Base and Table • ST_ID
with inserting
L-9 the records. • ST_NAME
• ST_ADD
• ST_PHONE NO.
• ST_HOBBIES
In the design view and add at least 10 records in the
table.
To Understand Create a database named EMPLOYEE with the 19/08
the construction following fields as EMPLOYEE NAME,
process of Data EMPLOYEE CODE, EMPLOYEE
L-10 Base and Table DESIGNATION, EMPLOYEE DEPARTMENT,
with inserting DATE OF JOINING and YEAR OF
the Deleting
EXPERIENCE. Delete any two records as well as
records.
fields from the table to show the output.
To Understand Create an EMPOYEE database with the following 19/08
the construction fields as
process of Data • Emp_code
Base and Table • Emp_ssn
with inserting
the records and • Emp_name
implement some • DOB
queries on it. • Emp_design
• Emp_dept
• DOJ
• E_SAL
L-11 • Years of experience
Ans. Data:
Data is information, such as figures and facts, that is used for decision-making or analysis.
Information that can be processed by a computer is known as computer data. Data can be found in
a variety of formats, including text or numbers written on paper, bits and bytes kept in electronic
memory, and facts retained in an individual's memory. Ever since computers were invented,
computer information that is transferred or stored has been referred to as data. Since the data is
kept in binary (zero or one) on the computer, it can be digitally processed, created, saved, and
stored. This makes it possible to transfer data between computers using a variety of media devices
or new connections
Information:
An information collection is beneficial to all parties involved because it aids in decision-making
for the individuals involved. Information can be found in a variety of formats, such as text, photos,
videos, and audio files. It is available via several platforms, including social media, the Internet,
and books. Information is essentially a representation of reality that is used to share knowledge
about the world we live in. Depending on its objective and target audience, it can be objective,
subjective, or even fictional and take on a variety of shapes.
Data that has been transformed into a more comprehensible or helpful form is called information.
It is a collection of data that has been arranged so that people can use it directly, as information
aids in decision-making. By putting together disparate data points into a meaningful format, the
information is produced. For instance, the information on the report card or sheet is the grades that
the students have received and their roll numbers. Pay stubs, schedules, reports, worksheets, bar
charts, invoices, account returns and so forth are examples of additional information formats.
Database:
An ordered collection of data that is simple to manage and access is called a database. To facilitate
finding pertinent information, data can be indexed, arranged into tables, rows, and columns, and
more. Database handlers design a database so that all users can access the data with just one set of
software. The primary function of a database is to manage, retrieve, and store a vast amount of
information. These days, databases are used to manage a large number of dynamic websites that
can be found on the Internet. Consider a model that verifies whether hotel rooms are available.
This is an illustration of a database-driven dynamic website. There are many databases available
like MySQL, Sybase, Oracle, MongoDB, Informix, PostgreSQL, SQL Server, etc. Modern
databases are managed by the database management system (DBMS). SQL or Structured Query
Language is used to operate on the data
DBMS:
The system software used to create and manage databases is called a database management system
(DBMS). End users can create, protect, read, update, and delete data in a database with the help of
a DBMS. The most common kind of data management platform, the database management system
(DBMS) functions essentially as a conduit between users or application programmers and
databases, keeping data easily accessible and consistently organized. Data is managed by the
database management system (DBMS); its logical structure is specified by the database schema;
and data access, locking, and modification are made possible by the database engine. In addition
to providing concurrency, security, and data integrity, these three fundamental components also
support standard data administration practices. Numerous common database administration tasks,
such as change management, security, backup and recovery, and performance monitoring and
tuning, are supported by the DBMS.
RDBMS:
Relational Database Management System is referred to as RDBMS. All contemporary database
systems, including MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access, are built
on top of RDBMS. A database management system (DBMS) that is built on the relational model,
first presented by E. F. Codd in 1970, is known as a relational database management system
(RDBMS). Because cloud-based relational databases such as Cloud SQL, Cloud Spanner, and
Alloy DB provide managed services for infrastructure support, patching, capacity management,
provisioning, and database maintenance, they have grown in popularity. The main benefit of the
relational database model is that it provides an intuitive way to represent data and allows easy
access to related data points. As a result, relational databases are most used by organizations that
need to manage large amounts of structured data, from tracking inventory to processing
transactional data to applicationlogging.
2. Open Access 2013 and click on blank document and rename the database.
Elements of a database:
Tables:
To store your data, you create one table for each type of information that you track. Types of information
might include customer information, products, and order details. To bring the data from multiple tables
together in a query, form, or report, you define relationships between the tables.
Query:
A query can help you find and retrieve the data that meets conditions that you specify — including data
from multiple tables. You can also use a query to update or delete multiple records at the same time and
to perform predefined or custom calculations on your data.
Forms:
You can use a form to easily view, enter, and change data one row at a time. You can also use a form to
perform other actions, such as sending data to another application. Forms typically contain controls that
are linked to underlying fields in tables. When you open a form, Access retrieves the data from one or
more of those tables, and then displays the data in the layout that you chose when you created the form.
You can create a form by using one of the Form commands on the Ribbon, the Form Wizard, or create a
form yourself in Design view.
Report:
You can use a report to quickly analyze your data or to present it a certain way in print or in other
formats. For example, you may send a colleague a report that groups data and calculates totals. Or, you
may create a report with address data formatted for printing mailing labels.
In the database view, a database can be created by filling out the fields with headings and then the
relevant data can be filled under the headings in the cells.
1. Start by clicking Short Text in the new field heading.
4. Rename the ID column and by right clicking toggle off the primary key.
SQL:
Programming languages such as structured query language (SQL) are used to store and handle
data in relational databases. Data is stored in tabular form in relational databases, where
different data attributes and the relationships between the data values are represented by rows
and columns. Information from the database can be stored, updated, removed, searched for, and
retrieved using SQL statements. SQL can also be used to enhance and maintain database
performance. Based on the relational data model, SQL was created in the 1970s. The structured
English query language (SEQUEL) was its original moniker. Later, the word was abbreviated to
SQL.
1. DDL:
A computer language called a data definition language (DDL) is used to create and alter the
structure of database objects within a database. Views, schemas, tables, indexes, and other
database objects are among them. In some contexts, this term is also referred to as "data
description language" because it describes the records and fields found in database tables. A
computer language called a data definition language (DDL) is used to create and alter the
structure of database objects within a database. Views, schemas, tables, indexes, and other
database objects are among them. In some contexts, this term is also referred to as "data
description language" because it describes the fields and records found in database tables.
Commands under DDL are as follows:
CREATE: The CREATE TABLE is a DDL statement which is used to create tables in the
database. The table gets created as soon as the CREATE TABLE script is executed and is ready
to hold the data onwards. The user must have the CREATE TABLE system privilege to create
the table in its own schema.
Syntax: CREATE TABLE table_name (column1 datatype, column2 datatype);
ALTER TABLE: ALTER SQL command is a DDL (Data Definition Language) statement.
ALTER is used to update the structure of the table in the database (like add, delete, modify the
attributes of the tables in the database).
Syntax: ALTER TABLE table_name ADD column_name datatype;
Example: ALTER TABLE customers ADD email VARCHAR(100);
2. DQL:
Data query language (DQL) is part of the base grouping of SQL sub-languages. These sub-
languages are mainly categorized into four categories: a data query language (DQL), a data
definition language (DDL), a data control language (DCL), and a data manipulation language
(DML).
SELECT: The SELECT command is used to query or retrieve data from a table in the database.
It is used to retrieve a subset of records from one or more tables.
FROM employees
WHERE hire_date > '2022-01-01';
INSERT: INSERT is another most important data manipulation command in Structured Query
Language, which allows users to insert data in database tables.
4. Then fields with respective Data Type and then save the table.
Q. What do you mean by field name, data type, field size & description?
Field Name:
A field name is a fundamental component of a database table, serving as a label or identifier for
specific data within that table. Field names are crucial for uniquely identifying and referencing
individual data elements. For instance, in a table containing information about customers, you
might have field names like "Customer_ID," "FirstName," and "Last_Name." These names help
you understand and manipulate the data stored in the table.
Data Type:
Data type refers to the nature or kind of data that can be stored in a particular field within a
database. Different data types are available to cater to various types of information. Common
data types include Text, Number, Date/Time, Boolean, and more. The data type determines how
the data is stored, validated, and processed. For example, a "Date of Birth" field would typically
have a data type of "Date/Time" to ensure it only accepts valid dates.
Field Size:
Field size specifies the maximum allowable length or size of data that can be stored in a
particular field within a database table. It ensures that data entered into the field conforms to a
predetermined limit. For example, a "Product Description" field might have a field size of 255
characters, meaning that product descriptions cannot exceed 255 characters in length. Field size
helps manage data integrity by preventing overly long or incorrect entries that could disrupt the
database's structure.
Description:
Description is an optional property that allows you to provide additional information or context
about a field within a table. This description can be used to explain the purpose or usage of a
particular field to database users or other developers. It serves as documentation within the
database, making it easier for individuals who work with the data to understand its significance.
Descriptions can be particularly helpful in large and complex databases, providing clarity and
aiding in data management and collaboration.
3. Go to Design View, add fields and select respective Data Type and then save the table and
then fill in the data in Datasheet View.
2. Add the fields remove primary key from Enrolment No and change the Data Type of DOB to
Date/Time.
Steps:
1. Create a blank database named as ‘Employee’. Then under Design View change the Data Type
wherever required after saving the table as ‘Employee_Data’.
2. Save it and go to Datasheet View and add 7 records. Start deleting a record by left clicking on the
extreme left cell of the respective field that needs to be deleted.
7) Emp_DOJ
8) Emp_Salary
9) Emp_YOE
Enter 10 records. For the above created database, set the following field properties:
Steps:
1. Create a database named Employee and fill resepective fields and data.
3. Click on Emp_dept and Under general wizard, make Default Value “HR”
4. Click on the data type for the field “Emp_DOJ”. Under general wizard, make default
value = “date ()”
6. Save the changes and then enter the data in the datasheet view.
3. Enter the data in the table and check if the previous commands are executed properly.
5. In case you try to add same S_ID for a different row, an error will pop-up as Primary key
should have unique values.
7. Error will appear in case of a rule-break. Name should start with A and end with M according
to the Validation Rule set.
2. Enter the records using “New faculty” and arrange faculty name in ascending order
4. To find reports generated by all faculty, in reports field select “All faculty”
2. Indexing: A primary key is automatically indexed by Microsoft Access. This indexing helps
improve the performance of database queries, as it allows for faster data retrieval when
searching for specific records based on the primary key.
3. Non-Null: The primary key columns must have non-null (i.e., not empty) values for every
record. This ensures that there are no gaps or missing values in the primary key, as every record
must have a unique identifier.
4. Relational Integrity: Primary keys are used to establish relationships between tables in a
relational database. They serve as a reference point for creating foreign keys in other tables,
which, in turn, helps maintain referential integrity, ensuring that data remains consistent and
accurate across related tables.
5. AutoNumber Data Type: In many cases, an AutoNumber data type is used for primary key
columns. An AutoNumber column automatically generates a unique numeric value for each
new record added to the table, simplifying the process of ensuring uniqueness.
Composite key:
In Microsoft Access, a composite key is a key that consists of two or more columns in a database
table. Unlike a single-column primary key, which is made up of a single field, a composite key is
created by combining multiple fields to create a unique identifier for each record in the table. Here
are the key features and characteristics of a composite key in MS Access:
1. Uniqueness: Just like a single-column primary key, a composite key must ensure the
uniqueness of each combination of values across the selected columns. This means that no two
records in the table can have the same values in all of the composite key columns.
2. Data Integrity: Composite keys help enforce data integrity by preventing the insertion of
duplicate records based on the combination of values in the key columns.
3. Relationships: Composite keys are often used in relational databases to establish relationships
between tables. They can serve as foreign keys in related tables, allowing for the creation of
complex and meaningful relationships.
4. Querying: Composite keys can be used in queries and joins to link related tables together. They
are especially useful when the relationship between tables is based on multiple fields.
5. Flexibility: Composite keys provide flexibility in designing databases where a single column
cannot uniquely identify a record. They are particularly useful in situations where natural keys
(existing data attributes) are not sufficient for ensuring uniqueness.
2. Then go to Design tab, Drag Emp_ID and drop it at Dept_ID. Next, inside the pop-up box in
the Related Table drop down select Dept_ID to establish a 1:1 relationship.
5. To create 1:M and M:1, drag Emp_ID and drop it at Dept_Details table, then under Dept_Details drop
down select Dept_Location. Select Enforce Referential Integrity and then click on Ok.
3. The Query will be created. Click on Acc_No, then Go to Sort drop down menu and select Ascending.
4. Under Criteria for [Acc_No] field write “=675” and under [Acc_Name] field write =”Ajay”. Then
under Design tab Run the quer
6. We can see the results with the mentioned criteria in the output.
2. S_name
3. Course_id
4. Batch
5. Semester
6. To get the output where only the S_name is visible from the Batch 2017-20:
➢ Again, select the table and go to Query Wizard → Simple Query →Next →Next→Finish.
➢ SQL View
➢ Write SELECT S_name
➢ FROM Student
➢ WHERE Batch = “2017-20”;
3rd query
10. Under the SQL View write the following syntax:
➢ SELECT Enroll_No, Batch
➢ FROM Student
➢ WHERE Batch = “2017-20” and Course_id = “17
Insert the data into the table Customer and apply the queries.
i Display customer details having designation Sales representative.
ii Retrieve customers who is living in Canada.
iii Show details of the customer whose name is Victoria.
iv Show details of the customer who lives in Sweden.
v Show details of the customer who is owner.
4. To Display the name of the students whose name starts with the letter "A"
➢ SELECT *
➢ FROM STUDENT
➢ WHERE Name like "A*";
1st query
3. Under Query1 write:
➢ SELECT Emp_ID
➢ FROM Employee
➢ WHERE Emp_name = “Supriya”;
3rd query
7. Again make a Query and under SQL View write:
➢ SELECT*
➢ FROM Employee
➢ WHERE Address = “D-29 IITM”;
4th query
9. Again make a Query and under SQL View write:
➢ SELECT Emp_name
➢ FROM Employee
➢ WHERE Salary >10000;
5th query
11. Again make a Query and under SQL View write:
➢ UPDATE Employee
➢ SET Emp_grade = “C”
➢ WHERE Salary <10000;
Solution:
• Step 1: First create a Table Name Employee and enter the relevant entries.
• Step 2: For Query 1, “Delete the records of the Employee whose Emp_id is 101”.
• Step 4: For Query 2, “Delete the record of the employees whose Dept_name is HR and salary
>10000”.
• Step 6: For Query 2, “Delete the record of the employee whose name begins with S or salary
>10000”.
• Step 8: For Query 2, “Update the record of the employees, set Dept_name = IT where Dept_name
is PRODUCTION”.
3. Display the name and S.NO of those students who have scored marks-95.
The course will have values either ISM or FMI. Enter 5 records. Create a form for the above
table in design view. Add text box and the following buttons to it:
➢ Go to the first record.
➢ Go to the last record.
➢ Go to previous record.
➢ Go to next record Add a label student form to it.
4. This will show you the details of all the students having the Course_Name FMI or ISM.
6. Then go to the form layout design and click on the button option.
7. Click on the form and then you will get the window of command Button Wizard. Click on the
Go to first record option and click next.
BCA1001 Abhay 85
BCA1002 Anuj 75
BCA1003 Bheem 60
BCA1004 Ram 79
BCA1005 Sumit 80
Example 2: This example shows all the values of a specific column from the table.
SELECT Emp_Id, Emp_Salary FROM Employee;
This SELECT statement displays all the values of Emp_Salary and Emp_Id column
of Employee table:
Emp_Id Emp_Salary
201 25000
202 45000
203 30000
204 29000
205 40000
101 Ramesh 92 20
201 Jatin 83 19
Suppose, you want to insert a new record into the student table. For this, you have to write the
following DML INSERT command:
INSERT INTO Student (Stu_id, Stu_Name, Stu_Marks, Stu_Age) VALUES (104, Anmol, 89,
19);
P101 Chips 20 20
P102 Chocolates 60 40
P201 Biscuits 80 20
P203 Namkeen 40 50
Suppose, you want to update the Product_Price of the product whose Product_Id is P102. To
do this, you have to write the following DML UPDATE command:
UPDATE Product SET Product_Price = 80 WHERE Product_Id = 'P1
P101 Chips 20 20
P102 Chocolates 60 40
P103 Maggi 75 5
P201 Biscuits 80 20
P203 Namkeen 40 50
Suppose, you want to delete that product from the Product table whose Product_Id is P203.
To do this, you have to write the following DML DELETE command:
DELETE FROM Product WHERE Product_Id = 'P202' ;
Q. Queries using Data Manipulation Commands like INSERT, UPDATE, DELETE and
DDL Commands Like CREATE, ALTER and DROP.
Insert record into Table named Student with Fields
• Student_ID
• Name
• Age
• Course Fees.
And appl y above mentioned commands on the table.
SOLUTION: Create a Database and go to SQL view and write the below mention
Query to create the Table.
Question: Write SQL Queries using Data Definition Commands Create Table named Employee
with Fields
• EMP_ID
• EMP_NAME
• EMP_DESIGNATION
• EMP_DEPARTMENT
• EMP_CONTACT
And make EMP_ID as the primary key.
Answer:
SQL Query
Steps:
Step 4: In SQL View, type Query for creating table and for making EMP_ID a primary key,
write PRIMARY KEY in Query after Data type of EMP_ID.
Question: Write SQL Queries using Data Definition Commands. Create Table named Employee
with Fields
• EMP_ID
• EMP_NAME
• EMP_DESIGNATION
And make EMP_ID as the primary key. Apply TRUNCATE, RENAME and ALTER commands.
Answer:
SQL Queries
1. CREATE TABLE Employee (EMP_ID NUMBER PRIMARY KEY, EMP_NAME
TEXT, EMP_DESIGNATION TEXT)
1. INSERT
Definition: The INSERT INTO command in SQL is used to insert new records (rows) into a database
table. It has the following syntax:
2. UPDATE
Definition: the "UPDATE" command is used in SQL (Structured Query Language) to modify existing
records in a database table. It allows you to change the values of one or more columns in one or more
rows of a table based on a specified condition.
WHERE condition;
3. DELETE
Definition: The DELETE statement in SQL is used to remove one or more rows from a table based on
a specified condition. It is a Data Manipulation Language (DML) command and is used to modify data
in a database.
Syntax: DELETE FROM table_name
WHERE condition;
Example: DELETE FROM Employees
WHERE EmployeeID = 2;
Question: Write SQL Queries using Data Manipulation Commands. Insert record into Table
named Employee with Fields:
• EMP_ID
• EMP_NAME
• EMP_DESIGNATION
• EMP_DEPARTMENT
• EMP_CONTACT
And make EMP_ID as the primary key.
And apply above mentioned commands on the table.
Answer:
SQL Queries:
Q. Define all the Aggregate Functions with their work defined in the SQL.
Solution: Aggregate functions are used to perform calculations on sets of values and return a single
value as a result. These functions operate on a group of rows and produce a single value for that
group. Here are some common aggregate functions in SQL and their brief descriptions:
1. COUNT FUNCTION: COUNT () is used to count the number of rows in a result set that meets a
specified condition. It can be used with the asterisk (*) to count all rows or with a specific column
to count non-null values in that column.
2. SUM FUNCTION: SUM () calculates the sum of all values in a numeric column.
3. AVG FUNCTION: AVG () computes the average (mean) of values in a numeric column.
5. STDDEV FUNCTION: STDEV () is used to calculate the standard deviation of a set of numeric
values within a specified column. The standard deviation is a statistical measure of the amount of
variation or dispersion in a dataset. It provides insight into how spread out the values are and how
much they deviate from the mean (average).
6. VARIANCE FUNCTION: The variance is a statistical measure that quantifies how data points in
a dataset differ from the mean (average) value. It is calculated as the average of the squared
differences between each data point and the mean.
• EMP_ID
• EMP_NAME
• EMP_DESIGNATION
• EMP_AGE
• EMP_DEPARTMENT
• EMP_SALARY
And make EMP_ID as the primary key.
1. Write a query to find the salary of a person where age is <= 26 and salary >= 25000 from
Employee Table.
2. Write a query to find the name of Employee whose name is like “Ku%”.
3. Write a query to find the customer details using “IN” and “Between” operator where age
can be 25 or 27.
Solution:
• Step 1: First create a Table Name Student_Marks and enter the relevant entries.
• Then select on open the query to open the information tab, then click on finish.
• Step 3: For Query 1, “to find the salary of a person where age is <= 26 and salary >= 25000”,
write the query as shown below and then click on “RUN”.
• Step 4: On running the query, the output will display the age of employees whose <= 26 and
salary >= 25000” .
• Step 5: For Query 2, “to find the name of Employee whose name is like Ku%”, write the query
as shown below and then click on “RUN”.
• Step 7: For Query 3, “to find the customer details using “IN” and “Between” operator where
age can be 25 or 27”. write the query as shown below and then click on “RUN”.
• Step 8: On running the query, the output will the details of employee whose age can be 25 or
27.
1. Write a query to find the Name of Product where PRO_PRICE>= 500 from PRODUCT
Table.
2. Write a query to implement Aggregate Functions on field PRICE”.
3. Write a query to COUNT the number of Records in the Product Table.
SOLUTION: -
• Create a table with fields mentioned above in question, using SQL commands.
• Click on run and you can see that the table is created.
• Click on run and you can see that the record has been entered.
• Write the mentioned query to get the names of those products whose price>=500.
• Write the below mentioned query to Sum the Price of the products.
A new dialogue box will open, in that box enter the table names and column names, between which we
want to establish relationships and click on ok.
Below is a simplified example that includes essential entities in a college management system:
Entities:
1. Student:
• Attributes: Student_ID (Primary Key), Name, Contact, DOB.
2. Course:
• Attributes: Course_ID (Primary Key), Course Name.
3. Faculty:
• Attributes: Faculty_ID (Primary Key), Name, Subject.
4. Department:
• Attributes: Department_ID (Primary Key), Department Name.
• Cardinality Notation: Many Students (M) can enrol in Single (1) Course.
• Explanation: A student can enrol in single course, but a course can have multiple students
enrolled in it.
• Cardinality Notation: Many Faculty members (M) can be associated with (1) Department.
• Explanation: Many faculty members can belong to a single department, but each faculty
member is associated with at most one department.
The EntityRelationship (ER) diagram for an airline reservation system is a visual representation
of the data model that describes the structure of the system and the relationships between different
entities. Here's a brief explanation of the key elements:
1. Entities:
• Passenger Entity: Represents individuals who use the reservation system. It contains
attributes like PassengerID (unique identifier), Name, and ContactNumber.
• Flight Entity: Represents a scheduled flight. It has attributes like FlightID (unique
identifier), Airline, Departure Time, Arrival Time, Desto
• Airport Entity- It represents where flight land.
• Booking Office- Represents Place where the ticket for the fight has been booked.
4. Primary keys
• Primary Keys: Unique identifiers for each entity (e.g., PassengerID, Office_ID,
Flight_no, Booking_No, Booking_no., Code).
Above is an Entity-Relationship Diagram (ERD) for an Employee Management System with four
entities: Employee, Department, Role, and Project.
1. Employee Entity (Attributes):
• EmployeeID (Primary Key)
• Name
• Contact
• Address
2. Department Entity (Attributes):
• Department_ID (Primary Key)
• Department_Name
• Book_ID(Primary Key)
• Book_Name
• Book_Author