0% found this document useful (0 votes)
13 views

Ism Lab File

Uploaded by

Akshat Goyal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Ism Lab File

Uploaded by

Akshat Goyal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 52

GURU GOBIND SINGH INDRAPRASTHA UNIVERSITY

MAHARAJA SURAJMAL INSTITUTE

Information System Management Lab


Subject Code-BBA-307

SUBMITTED BY SUBMITTED TO
[NAME] Dr. Ajay Phogat
Enrollment No: Assistant Professor
BBA (G) V SEM (EVE)
ISM LAB INDEX

S.No ASSIGNMENT DATE SIGNATURE


1. To introduce DBMS and RDBMS.

2. To understand various features of SQL.

3. What do you mean by Field Name, Data type, Field


size and Description.

4. Define data type and explain the various data types


available in MS-ACCESS.

5. Write steps to Open Microsoft Access. Write steps to


create a database.

6. Write steps to open an existing database

7. Write steps to create table in design view and


datasheet view.

8. What are the various data types in Database (One line


description of each with example). Create a student
database with a table STUDENT_DETAILS
containing the field name as
● ID
● FIRST NAME
● LAST NAME
● AGE
● ADDRESS

Insert 5 records using the design view in MS-


ACCESS.

9. Create a table using datasheet view as


STUDENT_COURSE with the field name as
● ID
● COURSE CODE
● COURSE NAME.
Enter records.

10. Define data type and explain the various data types
available in MS-ACCESS. Create a database DB1
with a table T1 with the following fields as:
⮚ ST_NO.
⮚ ST_ID
⮚ ST_NAME
⮚ ST_ADD
⮚ ST_PHONE NO.
⮚ ST_HOBBIES

In the design view and add at least 10 records in the


table.

11. Create a database named EMPLOYEE with the


following fields as EMPLOYEE NAME,
EMPLOYEE CODE, EMPLOYEE DESIGNATION,
EMPLOYEE DEPARTMENT, DATE OF JOINING
and YEAR OF EXPERIENCE.

Delete any two records as well as fields from the table


to show the output.

12 Create an EMPOYEE database with the following


fields as
⮚ Emp_code
⮚ Emp_ssn
⮚ Emp_name
⮚ DOB
⮚ Emp_design
⮚ Emp_dept
⮚ DOJ
⮚ E_SAL
⮚ Years of experience

For the above created database set the following


fields properties:
1. Employee names should be in upper
case with field size equal to10
2. Set the default value of Emp_dept as
HR.
3. Date of joining should be set to the
current date by default
4. E_SAL should be in dollars.

13 Create a table as STUDENT_DETAILS with the


following fields

⮚ S_id
⮚ S_name
⮚ S_course
⮚ S_marks
⮚ S_dob
Make S_id as the primary key and apply the
following validations:
1.S_name should start with A and end with
M.
2.S_course can have only BBA OR MBA as
its values.
3.S_marks, it can be NULL or should be > 50.
4.S_dob should be less than the current date.
Enter at least 10 entries in the table.

14 Write steps to put password on the database and


convert it into the required format.

15. Explain in brief about the query object in MS-


ACCESS 2007. Write steps to execute queries using
the query wizard. Create an ACCOUNT table with the
following fields:

• Acc no
• Act type
• Do_opening
• Transaction_type
• Balance
• Account H_name
• Transaction ID
Enter 12 records in the table and perform the
following queries on it.
1. Display the acc no in ascending order.
2. Display the details of account where acc no is
675.
3. Display the details of where acc no is 675 and
name is Nikita.
4. Display the acc no, acc type, account H_name
and balance where balance is greater than
5000.
16. Create a table named as STUDENT with the
following fields as:
● S_no
● Name
● City
● Age
Execute the following queries after entering 10
records in the table.
● Display all the details of the given
table
● Display the names in alphabetical
order
● Display the name along with the
marks where marks are greater than
60
● Display the name of students whose
name starts with letter ‘A’.
● Display the details of students who
live in ‘Delhi’.
● Display the details of students who
are older than 10 years.

17. Create a table EMPLOYEE either the following


fields:
● Emp_id
● Emp_name
● Dept_name
● Salary
● Add
● Date of joining
Perform the following queries on it.
1. Delete the records of the employee
whose Emp_id is 101
2. Delete the record of the employees
whose Dept_name is HR and salary
>10000
3. Delete the record of the employee whose
name begins with S or salary >10000
4. Update the record of the employees, set
Dept_name = IT where Dept_name is
PRODUCTION.
5. Update the record of the employee, set
salary to 15000 where Dept_name is IT.

18. Create a table employee with the following fields:


● Emp_id, Emp_name, Contact no,
Gender, Salary, Emp_grade,
Designation, Address

Execute the following queries on the table created:

1. Display the details of the employees


2. Display the employee id of employee whose
name is reeya.
3. Display the name of the employee whose
contact no. is 98454863011.
4. Display the details of the employee
whose address is JANAKPURI.
5. Display the name of the employees
whose salary is greater than 10,000.
6. Update the employee details, set
EMP_GRADE equal to C whose salary
is less than 10000.
7. Delete the record of the employee
whose gender is male and designation is
manager
8. Display the name, designation, and
salary of all the employees whose
names begins with A.
9. Update the employee details; set
designation to assistant manager where
designation is trainee.
10. Display the employee id, name, salary
and designation for the employees
whereemp_grade is A.

19. Create a table employee with the following fields:


● Emp_id
● Emp_name
● Dept_name
● Salary
● Address
● Dob
1. Find the employee ids of the employees
having same salary.
2. Find the details of the employee working in
the same dept.

Find employee id, emp-name of the employee having


same dob.
Assignment No.-1
Q. To introduce DBMS and RDBMS.
Solution-
DBMS is a software for storing and retrieving users’ data while considering appropriate security
measures. It consists of a group of programs which manipulate the database. The DBMS accepts
the request for data from an application and instructs the operating system to provide the specific
data. In large systems, a DBMS helps users and other third-party software to store and retrieve
data.
DBMS allows users to create their own databases as per their requirement. The term “DBMS”
includes the user of the database and other application programs. It provides an interface
between the data and the software application.
Example of a DBMS
Let us see a simple example of a university database. This database is maintaining information
concerning students, courses, and grades in a university environment. The database is organized
as five files:
The STUDENT file stores data of each student
The COURSE file stores contain data on each course.
The SECTION stores the information about sections in a particular course.
The GRADE file stores the grades which students receive in the various sections
The TUTOR file contains information about each professor.
Characteristics of DBMS-----
Here are the characteristics and properties of Database Management System:
1. Provides security and removes redundancy
2. Self-describing nature of a database system
3. Insulation between programs and data abstraction
4. Support of multiple views of the data
5. Sharing of data and multiuser transaction processing
6. Database Management Software allows entities and relations among them to form tables.
7. It follows the ACID concept (Properties) ( Atomicity, Consistency, Isolation, and
Durability).
Relational Model
Relational DBMS is the most widely used DBMS model because it is one of the easiest. This
model is based on normalizing data in the rows and columns of the tables. Relational model
stored in fixed structures and manipulated using SQL.
Relational Model was proposed by E.F. Codd to model data in the form of relations or tables.
After designing the conceptual model of Database using ER diagram, we need to convert the
conceptual model in the relational model which can be implemented using any RDBMS
languages like Oracle SQL, MySQL etc. So, we will see what Relational Model is.
Relational Model represents how data is stored in Relational Databases. A relational database
stores data in the form of relations (tables). Consider a relation STUDENT with attributes
ROLL_NO, NAME, ADDRESS, PHONE and AGE shown in Table 1.
STUDENT

ROLL_NO NAME ADDRESS PHONE AGE

1 RAM DELHI 9455123451 18

GURGAO
2 RAMESH N 9652431543 18

IMPORTANT TERMINOLOGIES
Attribute: Attributes are the properties that define a relation. e.g.; ROLL_NO, NAME
Relation Schema: A relation schema represents name of the relation with its attributes. e.g.;
STUDENT (ROLL_NO, NAME, ADDRESS, PHONE and AGE) is relation schema for
STUDENT. If a schema has more than 1 relation, it is called Relational Schema.
Tuple: Each row in the relation is known as tuple. The above relation contains 4 tuples, one of
which is shown as:

RA
1 M DELHI 9455123451 18

Relation Instance: The set of tuples of a relation at a particular instance of time is called as
relation instance.
Assignment No.- 2

Q. To understand various features of SQL.


Solution-
Structured Query Language (SQL) is a standard programming language specifically designed for
managing and manipulating databases. Here’s an overview of various key features of SQL:
1. Data Querying
● SQL allows you to retrieve specific data from a database using SELECT statements. You
can filter, sort, and group the data as needed.
2. Data Manipulation (DML)
SQL provides commands to insert, update, and delete data within a database.
● INSERT: Adds new records to a table.
● UPDATE: Modifies existing records.
● DELETE: Removes records from a table.
3. Data Definition (DDL)
SQL also includes commands to create, modify, and delete the structure of database objects such
as tables, indexes, and views.
● CREATE TABLE: Defines a new table.
● ALTER TABLE: Modifies an existing table (e.g., adding a column).
● DROP TABLE: Deletes an entire table.
4. Data Control (DCL)
SQL allows database administrators to control access to data using permissions.
● GRANT: Assigns specific permissions to users or roles.
● REVOKE: Removes previously granted permissions.
5. Transaction Control (TCL)
SQL provides commands for managing database transactions. Transactions are groups of SQL
operations that are executed as a single unit.
● BEGIN TRANSACTION: Marks the beginning of a transaction.
● COMMIT: Saves all changes made in the transaction permanently.
● ROLLBACK: Undoes the changes made in the transaction.
6. Data Filtering with WHERE
SQL allows you to filter data using conditions. You can use operators like =, >, <, LIKE,
BETWEEN, and more in WHERE clauses.
7. Sorting Results with ORDER BY
SQL can sort query results using the ORDER BY clause.
8. Grouping Data with GROUP BY
The GROUP BY clause groups rows that have the same values into summary rows, often used
with aggregate functions like COUNT, SUM, AVG, MAX, and MIN.
Assignment No.- 3
Q. What do you mean by Field Name, Data type, Field size and Description.
Solution-
1. Field Name
● The Field Name is the label or identifier for a specific column in a database table. It
describes the type of data that will be stored in that column. Each field name should be
unique within the table, and it typically reflects the content of the data.
● Example: In a table named Customers, the field names might be:
o Customer ID
o First Name
o Last Name
o Email
2. Data Type
The Data Type defines the type of data that can be stored in a particular field. It ensures
that the data entered into the field is valid and consistent. Different data types handle
different kinds of information such as text, numbers, dates, and more.
● Common data types include:

o Text (or VARCHAR): For storing text or string data (e.g., names, addresses).
o Number (or INT): For storing numerical values (e.g., quantities, ages).
o Date/Time: For storing dates and times (e.g., birthdays, order dates).
o Boolean: For storing true/false or yes/no values.
o Currency: For storing monetary values (e.g., product prices).
● Example: FirstName might have a data type of Text, while Salary would have a data type
of Currency or Number.
3. Field Size
● Field Size specifies the maximum amount of data that can be stored in a field. It is
typically used for fields with data types like Text or Number.
o For Text fields, the field size determines how many characters can be stored. For
example, setting a field size of 50 means that the field can hold up to 50
characters.
o For Number fields, the field size controls the range or precision of the numbers
allowed (e.g., whether it's an integer or a floating-point number).
● Example: A Phone Number field might have a field size of 10 to store a 10-digit phone
number.
4. Description
● The Description is an optional text field where you can enter additional details about
the field, such as what the field represents or how it should be used. It’s primarily for
documentation purposes to help users or developers understand the field’s purpose.
o Example: For a field called DOB, the description could be: "Date of Birth of the
customer in MM/DD/YYYY format". This helps clarify how the data should be
entered or interpreted.
Assignment No.- 4
Q. Define data type and explain the various data types available in MS-ACCESS.
Solution-
A data type in a database defines the kind of data that can be stored in a particular field or
column. It specifies how the data will be stored, processed, and retrieved. Each field in a
database table must have a defined data type to ensure consistency and data integrity.
In Microsoft Access, various data types are available to accommodate different kinds of
information such as text, numbers, dates, and more.
Common Data Types Available in Microsoft Access:
1. Short Text
● Description: Used to store alphanumeric data (letters and numbers) with a maximum of
255 characters.
● Example: Names, addresses, phone numbers.
● Use Case: Best for shorter pieces of text such as a person's first name or a city name.
2. Long Text (Memo)
● Description: Stores lengthy text or combinations of text and numbers, with a capacity of
up to 65,536 characters.
● Example: Detailed descriptions, comments, or notes.
● Use Case: Used for storing larger bodies of text, such as a product description or notes
about a customer.
3. Number
● Description: Used to store numerical data. You can specify different number types like
Integer or Decimal.
● Example: Quantities, ages, salaries.
● Use Case: Used for mathematical operations or storing numerical data that doesn’t
involve currency.
4. Large Number
● Description: A 64-bit number that can store much larger numeric values than the
Number data type.
● Example: Used when working with very large numbers.
● Use Case: Suitable for scientific or financial data where larger numbers are needed.
5. Date/Time
● Description: Stores date and time information in a variety of formats.
● Example: Birthdates, order dates, or meeting times.
● Use Case: Ideal for fields that need to record when something happened or when it will
happen.
6. Date/Time Extended
● Description: Provides higher accuracy for date and time data, including support for
fractions of a second.
● Use Case: Useful for applications that require precision with time, such as in scheduling
or timestamps.
7. Currency
● Description: Used to store currency values with up to four decimal places of precision.
● Example: Product prices, salaries.
● Use Case: Designed for monetary data, ensuring precision without rounding errors
typical in floating-point arithmetic.
8. AutoNumber
● Description: Generates a unique sequential or random number automatically for each
new record.
● Example: Invoice numbers, customer IDs.
● Use Case: Commonly used as a primary key for uniquely identifying each record in a
table.
9. Yes/No (Boolean)
● Description: Stores only two values: Yes/No, True/False, or On/Off.
● Example: Active/inactive status, completed/uncompleted tasks.
● Use Case: Suitable for fields that require a simple binary choice, such as whether an item
is available in stock or whether a checkbox is checked.
10. OLE Object
● Description: Stores objects created in other applications (such as images, Word
documents, Excel spreadsheets).
● Example: Embedded images or documents.
● Use Case: Ideal for integrating objects from other applications, but may increase the
database size significantly.
11. Hyperlink
● Description: Stores links to web pages, email addresses, or files.
● Use Case: Useful for fields where you want to store URLs or links to external resources.
12. Attachment
● Description: Stores files, such as images, documents, or spreadsheets, that are attached to
records.
● Example: Product images, PDFs, Excel files.
● Use Case: Efficient for attaching files directly to database records, as it compresses the
attachments automatically.
13. Calculated
● Description: Allows you to store the result of an expression or formula based on other
fields in the same record.
● Example: Price * Quantity = Total Cost.
● Use Case: Great for automatically computing values without having to manually enter
them, such as calculating totals or other derived data.
14. Lookup Wizard
● Description: Helps create a field that uses values from another table or a predefined list
to populate the field.
● Example: Selecting a product name from a list of products.
● Use Case: Ideal for creating dropdown lists that pull values from another table or
predefined options, enhancing data entry consistency.
Assignment No.- 5
Write steps to Open Microsoft Access. Write steps to create a database. What are the various
elements/objects of a database? What are the various ways to create tables in database?

Answer.
Steps to open MS- Access:
STEP-1: Click on ‘Windows’.

STEP-2: Click on ‘All Programmes’. In ‘All programmes’ click on ‘Microsoft Office’.

STEP-3: Click on ‘MS Access’


STEPS TO CREATE DATABASE
STEP-1: Open MS Access

STEP-2: Select blank database

STEP-3: Enter file name and then click create.


Assignment No.- 6

Write steps to open an existing database?

Answer.
Step 1: Open MS Access

Step 2: On the right side there is a 'open recent database '

Step 3: Select the required database file.


Assignment No.- 7

Write steps to create table in design view and datasheet view.


Answer.
Steps to create database
• Open ms- access
• Select blank database
• Provide 'file name' and then click on create.

DESIGN VIEW
Step 1: Click on ‘View’
Step 2: Select ‘Design View’. The datasheet will open.
Step 3: Enter ‘Field Name’ and ‘Data Type’, as per the data.

DATASHEET VIEW
Step 1: Click on ‘View’
Step 2: Select ‘Datasheet View’. The datasheet will open.
Step 3: Create table on the basis of given data
Assignment No.- 8
What are the various data types in Database (One line description of each with
example). Create a student database with a table STUDENT_DETAILS containing
the field name as
● ID
● FIRST NAME
● LAST NAME
● AGE
● ADDRESS

Insert 5 records using the design view in MS-ACCESS.


Answer. Step 1: Click on ‘View’
Step 2: Select ‘Design View’. The datasheet will open.
Step 3: Enter ‘Field Name’ and ‘Data Type’, as per the data.
Step 4: Click on ‘View’
Step 5: Select ‘Datasheet View’. The datasheet will open.
Step 6: Create table on the basis of given data

TABLE 1: STUDENT_DETAILS
Assignment No.- 9
Create table using datasheet view as STUDENT_COURSE with the field name as
● ID
● COURSE CODE
● COURSE NAME.

Answer. Step 1: Click on ‘View’


Step 2: Select ‘Design View’. The datasheet will open.
Step 3: Enter ‘Field Name’ and ‘Data Type’, as per the data.
Step 4: Click on ‘View’
Step 5: Select ‘Datasheet View’. The datasheet will open.
Step 6: Create table on the basis of given data

TABLE 2: STUDENT_COURSE
Assignment No.- 10

Define data type and explain the various data types available in MS-ACCESS.
Create a database DB1 with a table T1 with the following fields as:
⮚ ST_NO.
⮚ ST_ID
⮚ ST_NAME
⮚ ST_ADD
⮚ ST_PHONE NO.
⮚ ST_HOBBIES
In the design view and add at least 10 records in the table.
Answer.
VARIOUS DATA TYPES IN DATABASE
Data Type Use For Size
Up to 255 characters. Microsoft Access
Text or combinations of text and
only stores the characters entered in a
numbers, such as addresses. Also
field; it does not store space characters for
numbers that do not require
Text unused positions in a Text field. To
calculations, such as phone
control the maximum number of
numbers, part numbers, or postal
characters that can be entered, set the
codes.
FieldSize property.
Lengthy text and numbers, such as
Memo Up to 64,000 characters.
notes or descriptions.
Numeric data to be used for
mathematical calculations, except
calculations involving money (use 1, 2, 4, or 8 bytes. 16 bytes for
Number
Currency type). Set the FieldSize Replication ID (GUID) only.
property to define the specific
Number type.
Date/Time Dates and times. 8 bytes.
Currency values. Use the
Currency data type to prevent
rounding off during calculations.
Currency 8 bytes.
Accurate to 15 digits to the left of
the decimal point and 4 digits to
the right.

AutoNumbe Unique sequential or random 4 bytes. 16 bytes for Replication ID


numbers automatically inserted
r (GUID) only.
when a record is added.
Assignment No.- 11

Create a database named EMPLOYEE with the following fields as EMPLOYEE


NAME, EMPLOYEE CODE, EMPLOYEE DESIGNATION, EMPLOYEE
DEPARTMENT, DATE OF JOINING and YEAR OF EXPERIENCE. Delete any
two records as well as fields from the table to show the output.

DELETING 2 RECORDS

Step 1: Select the records which you want to delete. Options will open. Click on ‘Delete
Record’
Step 2: A dialogue will open, asking for confirmation.
Step 3: Click on ‘Yes’

Final output

DELETING TWO FIELDS:

Step 1: Select the field which you want to delete. Options will open. Click on ‘Delete
Column’
Step 2: A dialogue will open, asking for confirmation.
Step 3: Click on ‘Yes’

FINAL OUTPUT

DELETE from Table_name where NAME=”RAVI”;


Assignment No.- 12
Create an EMPOYEE database with the following fields as

⮚ Emp_code
⮚ Emp_ssn
⮚ Emp_name
⮚ DOB
⮚ Emp_design
⮚ Emp_dept
⮚ DOJ
⮚ E_SAL
⮚ Years of experience

For the above created database set the following fields properties:
5. Employee names should be in upper case with field size equal to10
6. Set the default value of Emp_dept as HR.
7. Date of joining should be set to the current date by default
8. E_SAL should be in dollars.
Use Lookup Wizard.

Answer.
1. Employee names should be in upper case with field size equal to 10

Step 1: Open ‘General’ in ‘Design view’.


Step 2: Enter “10” in ‘Field size’. As given in question.
Step 3: Enter “>” in ‘Format’, for upper case

2. Set the default value of Emp_dept as HR.


Step 1: Open ‘General Wizard’ in ‘Design View’.
Step 2: Type ‘HR’ in ‘Default value’

3. Date of joining should be set to the current date by default


Step 1: Open ‘General Wizard’ in ‘Design View’
Step 2: Type ‘=Date()’ in ‘Default value’. For entering current date as default
4. E_SAL should be in dollars.
Step 1: Open ‘Design View’
Step 2: Select currency in data type of E_SAL
Step 3: In format property select the values with dollar sign

Output (final)
Assignment No.- 13

Create a table as STUDENT_DETAILS with the following fields


⮚ S_id
⮚ S_name
⮚ S_course
⮚ S_marks
⮚ S_dob
Make S_id as the primary key and apply the following validations:
1. S_name should start with A and end with M.
2. S_course can have only BBA OR MBA as its values.
3. S_marks, it can be NULL or should be > 50.
4. S_dob should be less than the current date.
Enter at least 10 entries in the table.

ANSWER.

Set ‘S_id’ as primary key


1. S_name should start with A and end with M.

Step 1: In design view, select S_name


Step 2: Enter “A*M” in Validation Rule, for applying the validation.

2. S_course can have only BBA OR MBA as its values.

Step 1: In design view, select S_course


Step 2: Enter “BBA Or MBA” in Validation Rule, for applying the validation.

3. S_marks, it can be NULL or should be > 50.

Step 1: In design view, select S_marks


Step 2: Enter “Is NULL or >50” in Validation Rule, for applying the validation.

4. S_dob should be less than the current date.

Step 1: In design view, select S_dob.


Step 2: Enter “<2/13/2019” in Validation Rule, for applying the validation.
Assignment No.- 14

Write steps to put password on the database and convert it into the required format.

Answer.
1. Choose Open from the Office menu.

2. Open Database in Exclusive mode.


3. Select encrypt with password from database tools.

4. Entre the password and select ok.


Assignment No.- 15
Ques. 11 Explain in brief about the query object in MS-ACCESS 2007. Write steps to execute
queries using the query wizard. Create an ACCOUNT table with the following fields:

• Acc no
• Act type
• Do_opening
• Transaction_type
• Balance
• Account H_name
• Transaction ID
Enter 12 records in the table and perform the following queries on it.
• Display the acc no in ascending order.
• Display the details of account where acc no is 675.
• Display the details of where acc no is 675 and name is AJAY.
Display the acc no, acc type, account H_name and balance where balance is greater
than 5000.

Steps to execute queries using the query wizard:


1. Create the required table.
2. For query click on “create” tab.
3. In the create tab there are two options i.e
● Query wizard
● Query design
4. Click on the “query wizard” and then select ‘Simple Query Wizard’.

5. Now a table would appear. Select the required field via drag and drop. Then click
“Next”. Click on “Finish”.
6. Give the required criteria, i.e., the queries and then click on “run”.

TABLE: ACCOUNT

1. Display the acc_no in ascending order.


OUTPUT

2. Display the details of account where acc no is 675.

OUTPUT

3. Display the details of where acc no is 675 and name is AJAY.

OUTPUT

4. Display the acc no, acc type, account H_name and balance where balance is
greater than 5000.
OUTPUT
Assignment No.- 16
Create a table named as STUDENT with the following fields as:
● S_no
● Name
● City
● Age
Execute the following queries after entering 10 records in the table.
● Display all the details of the given table
● Display the names in alphabetical order
● Display the name along with the marks where marks are greater than 60
● Display the name of students whose name starts with letter ‘A’.
● Display the details of students who live in ‘Delhi’.
● Display the details of students who are older than 10 years.
Answer.
Table: Student

● Display all the details of the given table

● Display the names in alphabetical order


● Display the name along with the marks where marks are greater than 60

● Display the name of students whose name starts with letter ‘A’.

● Display the details of students who live in ‘Delhi’.

● Display the details of students who are older than 10 years.


Assignment No.- 17
Create a table EMPLOYEE either the following fields:
● Emp_id
● Emp_name
● Dept_name
● Salary
● Add
● Date of joining
Perform the following queries on it.
1. Delete the records of the employee whose Emp_id is 101
2. Delete the record of the employees whose Dept_name is HR and salary >10000
3. Delete the record of the employee whose name begins with S or salary >10000
4. Update the record of the employees, set Dept_name = IT where Dept_name is
PRODUCTION.
5. Update the record of the employee, set salary to 15000 where Dept_name is IT.
Answer.
Table: Employee

1. Delete the records of the employee whose Emp_id is 101


2. Delete the record of the employees whose Dept_name is HR and salary >10000

3. Delete the record of the employee whose name begins with S or salary >10000

4. Update the record of the employees, set Dept_name = IT where Dept_name is


PRODUCTION.
(Note: 2 new records were added in the main table to execute query)

5. Update the record of the employee, set salary to 15000 where Dept_name is IT.
Assignment No.- 18
Create a table employee with the following fields:
● Emp_id, Emp_name, Contact no, Gender, Salary, Emp_grade,
Designation, Address
Execute the following queries on the table created:

1. Display the details of the employees


2. Display the employee id of employee whose name is reeya.
3. Display the name of the employee whose contact no. is 98454863011.
4. Display the details of the employee whose address is JANAKPURI.
5. Display the name of the employees whose salary is greater than 10,000.
6. Update the employee details, set EMP_GRADE equal to C whose
salary is less than 10000.
7. Delete the record of the employee whose gender is male and
designation is manager
8. Display the name, designation, and salary of all the employees whose
names begins with A.
9. Update the employee details; set designation to assistant manager
where designation is trainee.
10. Display the employee id, name, salary and designation for the
employees where emp_grade is A.
Solution
1. SELECT * FROM EMPLOYEE;
2. SELECT EMP_ID FROM EMPLOYEE WHERE NAME=”REEYA”;
3. SELECT NAME FROM EMPLOYEE WHERE
CONTACT=98454863011;
4. SELECT * FROM EMPLOYEE WHERE
ADDRESS=”JANAKPURI”;
5. SELECT NAME FROM EMPLOYEE WHERE SALARY>10000;
6. UPDATE EMPLOYEE SET EMP_GRADE=”C” WHERE
SALARY<10000;
7. DELETE FROM EMPLOYEE WHERE GENDER=”MALE” AND
DESIGNATION=”MANAGER”;
8. SELECT NAME, DESIGNATION, SALARY FROM EMPLOYEE
WHERE NAME LIKE ”A*”;
9. UPDATE EMPLOYEE SET DESIGNATION=”ASSISTANT
MANAGER” WHERE DESIGNATION=”TRAINEE”;
10. SELECT EMP_ID, NAME, SALARY, DESIGNATION FROM
EMPLOYEE WHERE EMP_GRADE=”A”;

Answer.

Table: Employee

1. Display the details of the employees.

2. Display the employee id of employee whose name is supriya.


3. Display the name of the employee whose contact no. is 98454863011.

4. Display the details of the employee whose address is D-29, IITM, JANAKPURI.

5. Display the name of the employees whose salary is greater than 10,000.

6. Update the employee details, set EMP_GRADE equal to C whose salary is less than
10000.
CLICK ‘YES’.

7. Delete the record of the employee whose gender is male and designation is manager.

8. Display the name, designation, and salary of all the employees whose names begins
with A.
9. Update the employee details; set designation to assistant manger where designation
is trainee.
Assignment No.- 19
Create a table employee with the following fields:
● Emp_id
● Emp_name
● Dept_name
● Salary
● Address
● Dob
1. Find the employee ids of the employees having same salary.
2. Find the details of the employee working in the same dept.

Find employee id, emp-name of the employee having same dob.


ANS. STEP 1: CREATE THE REQUIRED DATABASE.
QUERY1: Find the employee ids of the employees having same salary.

QUERY2: Find the details of the employee working in the same dept.

QUERY3: Find employee id, emp-name of the employee having same dob.

You might also like