ISM Practical
ISM Practical
Users of DBMS are allowed to manipulate the data inside the database, as
well as the structure of the database.
There are different types of DBMS.
3
RDBMS: A relational database management system (RDBMS) is a
collection of programs and capabilities that enable users to create, update,
administer and otherwise interact with a relational database.
DBMS RDBMS
It deals with a small quantity of data. It deals with large amounts of data.
4
DIFFERENT WAYS OF CREATING TABLES IN MS ACCESS :-
Step 1: Click on search window @ taskbar.
5
Step 3: Double click on the icon.
Step 4: Click create and then click table icon.
6
7
DIFFERENT WAYS OF CREATING TABLES IN MS ACCESS AND
DIFFERENT DATA TYPES USED IN TABLES IN MS ACCESS.
Steps-
Step 1: Open MS Access, click on create and then click on table icon.(Here you
can see Various Types of VIEWS OF CREATING A TABLES IN MS
ACCESS).
FOR EXAMPLE.
9
AN EXAMPLE.
10
DIFFERENT FIELD PROPERTIES OF MS ACCESS TABLES
Field Size
In the Field Size box for Text fields, enter the maximum number of characters
that can be entered in the field. Suppose that the field you’re dealing with is ZIP
code, and you want to enter five-number ZIP codes. By entering 5 in the Field
Size text box, only five characters can be entered in the field. A sleepy data-
entry clerk couldn’t enter a six-character ZIP code by accident.
For Number fields, select a value for the field size from the drop-down list. The
table below describes these field sizes.
11
Access Numeric Field Sizes
Field Size Description
Format
Click the drop-down list and choose the format in which text, numbers, and
dates and times are displayed.
Decimal Places
For a field that holds numbers, open the Decimal Places drop-down list and
choose how many numbers can appear to the right of the decimal point. This
property affects how numbers and currency values are displayed, not their real
value. Numbers are rounded to the nearest decimal point. The Auto option
displays the number of decimal places permitted by the format you chose on the
Format drop-down list.
Input Mask
12
For Text and Date field types, this feature provides a template with punctuation
marks to make entering the data easier. Telephone numbers, social security
numbers, and other numbers that typically are entered along with dashes and
parentheses are ideal candidates for an input mask (another ridiculous database
term!). On the datasheet, blank spaces appear where the numbers go, and the
punctuation marks stand at the ready to receive numbers.
Input masks make data entry easier.
In the Input Mask text box, enter a 0 where numbers go and enter the
punctuation marks where they go. For example, enter (000) 000-0000 or
000/000-0000 to enter an input mask for a telephone number. You can also
create input masks by clicking the three dots beside the Input Mask text box.
Doing so opens the Input Mask Wizard dialog box, where you can fashion a
very sophisticated input mask.
Caption
If the field you're working on has a cryptic or hard-to-understand name, enter a
more descriptive name in the Caption text box. The value in the Caption
property appears as the column heading in Datasheet view, as a label on forms,
and on reports in place of the field name. People entering data understand what
to enter after reading the descriptive caption.
Default Value
When you know that the majority of records require a certain value, number, or
abbreviation, enter it in the Default Value text box. That way, you save yourself
the trouble of entering the value, number, or abbreviation most of the time
because the default value appears already in each record when you enter it. You
can always override the default value by entering something different.
Validation Rule
As long as you know your way around operators and Boolean expressions, you
can establish a rule for entering data in a field. For example, you can enter an
expression that requires dates to be entered in a certain time frame. Or you can
require currency figures to be above or below a certain value. To establish a
validation rule, enter an expression in the Validation Rule text box. To use dates
in an expression, the dates must be enclosed by number signs (#). Here are some
examples of validation rules:
13
>1000 The value you enter must be over 1,000.
>=#1/1/2019# And The date you enter must be in the year 2019.
<#1/1/2020#
To get help forming expressions, click the three dots beside the Validation Rule
text box to open the Expression Builder and build an expression there. Try
clicking the Help button in the Expression Builder dialog box. Doing so opens
the Access Help program, where you can get advice about building expressions.
Creating a validation rule.
Validation Text
If someone enters data that violates a validation rule that you enter in the
Validation Rule text box, Access displays a standard error message. The
message reads, “One or more values are prohibited by the validation rule set for
[this field]. Enter a value that the expression for this field can accept.” If this
message is too cold and impersonal for you, you can create a message of your
own for the error message dialog box. Enter your friendly message in the
Validation Text box.
Required
By default, no entry has to be made in a field, but if you choose Yes instead of
No in the Required box and you fail to make an entry in the field, a message
box tells you to be sure to make an entry.
14
know whether one person has an email address, you would leave the E-Mail
Address field blank. If, however, you knew that the person didn’t have an email
address, you could indicate as much by entering a zero-length string. Choose
Yes on the drop-down list to permit zero-length strings to be entered in the
field.
Indexed
This property indicates whether the field has been indexed. Indexes make
sorting a field and searching through a field go faster. The word No appears in
this text box if the field has not been indexed.
Unicode Expression
Choose Yes from the Unicode Expression drop-down list if you want to
compress data that is now stored in Unicode format. Storing data this way saves
on disk space, and you probably don't want to change this property.
Smart Tags
If you intend to enter Smart Tags in the field, indicate which kind you enter by
clicking the three dots next to the Smart Tags box and choosing an option in the
Action Tags dialog box.
Text Align
This property determines how the text is aligned in a column or on a form or
report. Select General to let Access determine the alignment, or select Left,
Right, Center, or Distribute.
Text Format
Available on Long Text fields, this drop-down list lets you choose to allow rich
text in the field. With this property set to Rich Text, you can make different
words bold, italic, underline, and change font sizes and colors. Set it to Plain
Text for plain, boring text with no formatting.
Append Only
Available on Long Text fields, this property lets you add data only to a Long
Text field to collect a history of comments.
15
This property is available on Date/Time fields. Choose For Dates to place a
button next to the column that data-entry clerks can click to open a calendar and
select a date instead of typing numbers.
16
Assignment 2
Output:
17
Quest 3:CREATE TABLE sp
(snoVARCHAR(5) NOT NULL REFERENCES s.
pnoVARCHAR(5) NOT NUILL REFERENCES p.
qty INT
PRIMARY KEY (sno, pno))
18
Quest 4: Alter the Table D.
Drop column city
19
Quest 5: Alter Table statement
Alter column name Varchar(25)
20
21
Assignment 3 DML Commands Create table customer
22
Display those rows where state
name begins with „D‟
Retrieve all rows where first
name
contains the word‟RAJ‟
Retrieve all rows where name
field contains the word‟RA
ESH‟
Retrieve all rows where city is
Delhi, Karnataka or Bangalore
Rename the table customer to
cust
Delete all those rows of
customers who stay in
Bangalore
Delete those customers who do
not have Pin Code
Rename column city to address
23
ASSIGNMENT-3
DML COMMANDS
Question 2 -Insert
Values in the table
24
Question 4 – Display CID and Fname
Syntax: Select CID, Fname from Customer
Output:
25
Question 7 – Display the states to which the customer belongs
Syntax: Select Distinct State from Customer
Output:
26
Question 10 – Display details of customer where CID is 102
Syntax: Select * from customer
where CID = 102
Output:
Question 11 – Retrieve all rows where CID is between 102 and 104
Syntax: Select * from Customer
where CID >= 102 and CID <= 104
Output:
Question 12 – Display data of those where state name begins with “D”
Syntax: Select * from Customer
where State LIKE "D%"
Output:
27
Question 13 – Retrieve all rows where state is Delhi, Karnataka, or Bangalore
Syntax: Select * from Customer
where State = "Delhi" or "Karnataka" or "Bangalore"
Output:
28
ASSIGNMENT-4
ADVANCED DML COMMANDS
29
Step 3: Enter values corresponding to their field name.
30
● Find names and salary of all the employees sorted according to salary
31
● List name of employees who live in Janakpuri
32
● List all employees whose F_name is “Ram” and L_Name is “Kapoor”
33
● Update the person named “Ram” to “Vikas”
34
● Update city of empid 101 to Jaipur
35
ASSIGNMENT 5
AGGREGATE/GROUPING FUNCTIONS
Step 1 – Open MS Access
(NAME VARCHAR(20),
DESIGNATION VARCHAR(20),
SALARY INT,
COMMISION INT,
DEPT VARCHAR(20)
Output:
values ("Ken","Intern",10000,2000,"HR")
Output:
36
Question 3 – Find average and total salaries of employees
FROM EMPLOYEE;
Output:
Syntax: Select Avg (Salary) as "Average Salary", Sum (Salary + Commision) as "Total
Salary"
from Employee
Output:
37
Question 5 – Find Minimum Salary of a Manager
Output:
Output:
38
Question 7 – How many employees are managers?
Output:
Step 1 -
Output:
39
Step 2 –
Output:
Output:
40
Syntax: Select Count (*) from
(Select Distinct Dept from Employee)
Output:
Question 11 – Update the commission to 10% Salary for all the employees having salary
greater than 50000
Output:
41
15%
Output:
Question 13 – Find the difference between highest and lowest salaries for each
department
From Employee
Group by Dept
Output:
42
Question 14 – List Designation of all employees where Salary is more than 40000
Output:
Output:
Question 16 – List Total, Max, Min, and Average Salary of employees Department wise
Syntax: Select Sum (Salary), Max (Salary), Min (Salary), AVG (Salary) from Employee
43
Group by Dept
Output:
44
ASSIGNMENT-6
E-R DIAGRAM
Q. What is E-R diagram & Notations for representing ER
diagrams?E-R Diagram
An entity relationship diagram (ERD) helps database designers review and
verify links between tables in a database. An ERD shows a visual representation
of primary and foreign keys, which are the columns used to link tables.
Microsoft Access includes a diagram utility that lets you create and view an
ERD for your Access database. You can also use this diagram to reverse
engineer any database.
Notations
o Rectangle
This Entity Relationship Diagram symbol represents entity types
45
o Ellipses
This symbol represents attributes
o Diamonds
This symbol represents relationship types
o Lines
It links attributes to entity types and entity types with other relationship
types
o Primary key
Attributes are underlined
o Double ellipses
Represent multi-valued attributes
46
47
Step2. Click on database tools, select relationships.
48
Step3. Click the Show Table button.
49
Note: Whenever you link a primary key from one table to a field from another
table, you create a foreign key.
Note: Referential integrity helps you avoid “orphan” records and maintains
database accuracy.
50
51
ASSIGNMENT-7
REPORTS
Reports organize and summarize data for viewing online or for printing. A detail
report displays all of the selected records. You can include summary data such as
totals, counts, and percentages in a detail report. A summary report does not list the
selected records but instead summarizes the data and presents totals, counts,
percentages, or other summary data only. Access has several report generation tools
that you can use to create both detail and summary reports quickly.
You can create a report either by using the Report Wizard, if you want to use more
than one table, or the Report button, if you already have a table or query open.
1. Select the table or query you want to base the report on.
You can also select either the Blank Report button (to create and display the report
in Layout View) or the Report Design button (to create and display a blank report
in Design View).
52
A report is instantly created based on the active table or query, and appears in Layout
View.
There are several ways to create reports in Access, they're listed in this table.
53
Report Buttons on the Home tab
Report Creates a new blank report in Design view, where you can make
Design more advanced changes to the report.
Blank
Creates a blank report with no fields or formatting.
Report
Report Shows the Report Wizard that helps you create simple,
Wizard customizable reports.
54
Step 3) Now name the various fields related to students’ performance in the table in design
view � Right click on Table section to save it with any name you would like to give to table.
Step 4) Now click on saved table from the navigation panel & edit the details of students
under different fields assigned to the table.
Step 5) After completing the table with all its fields � Click on create � Report.
55
Step 6) Finally check the output of student performance report in Report view.
56