Information Technology Part - B: Unit-3 Database Development I Define The Following
Information Technology Part - B: Unit-3 Database Development I Define The Following
• Data - refers to all the single items that are stored in a database, Data is raw,
unorganized facts that need to be processed. Data can be something simple
and seemingly random and useless until it is organized.
Ex : The average score of a class or of the entire school is information that can
be derived from the given data.
Advantages
Features of Database
• Database Server
A database server is a server which uses a database application that
provides database services to other computer programs or to computers,
as defined by the client–server model.
• Queries-Queries help us to retrieve the filtered data from the database based
upon the conditions. They are also used to perform actions such as delete,
update etc on the data.
• Forms-Forms are the user friendly interfaces that facilitate the process of
entering data in tables and queries. A form accepts the data from the user and
forwards it to the corresponding table or query.
Primary Key-A primary key is a special relational database table column (or
combination of columns) designated to uniquely identify all table records.
A primary key’s main features are:
• . For example, Student Table contains columns such as Rollno, Name, DOB ,
Address, Rollno can be considered as Primary Key
• Composite key (or) composite primary key - refers to cases where more than
one column is used to specify the primary key of a table.
• Foreign Key- A foreign key is a field or a column that is used to establish a link
between two tables. In simple words you can say that, a foreign key in one
table used to point primary key in another table.
Decimal Specifies the number of decimal places to use when displaying numbers.
Places
Input Mask Displays editing characters to guide data entry. For example, an input mask might
display a dollar sign ($) at the beginning of the field.
Caption The label text that is displayed for this field by default in forms, reports, and
queries. If this property is empty, the name of the field is used. Any text string is
allowed.
Relationships:
Relationships are the links that associate a field in one table with a field in
another table.
A relationship works by matching a field with the same name in both the
tables.
Many-to-Many
A pair of tables bears a many-to-many relationship when a single
record in the first table can be related to one or more records in the
second table and a single record in the second table can be related to
one or more records in the first table.
Criteria:
Query criteria helps you to retrieve specific items from an
Access database.
When you want to limit the results of a query based on the
values in a field, you use query criteria.
Multiple criteria:
Specify the single criteria in the criteria row and for multiple
criteria type the second condition on the Or row of the same
column
Wild card character: Wildcards are special characters that can stand in for unknown
characters in a text value and are handy for locating multiple items with similar, but
not identical data. Wildcards can also help with getting data based on a specified
pattern match.
[] Matches characters within the brackets. b[ae]ll finds ball and bell, but
not bill.
! Excludes characters inside the brackets. b[!ae]ll finds bill and bull, but
not ball or bell.
In Access, you can create a calculated field in a table. This eliminates the need for
a separate query to do calculations. For example, if you have a table that lists the
quantity, price and tax rate for each item in an order, you could add a calculated
field that shows the total price, like so:
[Quantity]*([UnitPrice]+([UnitPrice]*[TaxRate]))
The calculation cannot include fields from other tables or queries and the results of
the calculation are read-only.
Grouping of data :
The GROUP BY clause in Access combines records with identical values in the
specified field list into a single record. A summary value is created for each record
if you include an SQL aggregate function , such as Sum or Count, in the SELECT
statement.
Syntax:
SELECT fieldlist
FROM table
WHERE criteria
[GROUP BY groupfieldlist]
Access makes working with grouped reports easy. You can create a basic grouped
report by using the Report Wizard, you can add grouping and sorting to an existing
report, or you can revise grouping and sorting options that have already been
defined.
Forms:
Access is a database object that you can use to create a user interface for a database
application
Modifying Forms:
Layout view Layout view is the most intuitive view to use for form
modification, and it can be used for almost all the changes that you would want to
make to a form in Access.
In Layout view, the form is actually running. Therefore, you can see your data
much as it will appear when you are using the form. However, you can also change
the form design in this view. Because you can see the data while you are
modifying the form, this is a very useful view for setting the size of controls or
performing almost any other task that affects the appearance and usability of the
form.
If you encounter a task that cannot be performed in Layout view, you can switch to
Design view. In certain situations, Access displays a message that states that you
must switch to Design view before you can make a particular change.
Design view Design view gives you a more detailed view of the structure of your
form. You can see the Header, Detail, and Footer sections for the form. The form is
not actually running when it is shown in Design view. Therefore, you cannot see
the underlying data while you are making design changes. However, there are
certain tasks that you can perform more easily in Design view than in Layout view.
You can:
Add a wider variety of controls to your form, such as bound object frames, page
breaks, and charts.
Edit text box control sources in the text boxes themselves, without using the
property sheet.
Resize form sections, such as the Form Header or the Detail section.
Change certain form properties that cannot be changed in Layout view.
You use a form to manually update data. Data entry forms can provide an easier,
faster, and more accurate way to enter data. Forms can contain any number of
controls such as lists, text boxes, and buttons. In turn, each of the controls on the
form either reads data from or writes data to an underlying table field.
Find a record
You must first find a record before you can edit or delete it. In a form or datasheet
that contains only a small number of records, you can use the record navigation
buttons to navigate through the records until you find the one you want. When
there are many records, you can use the Find and Replace dialog box and filter for
the record.
In a table, to move to the next cell in a column, use the Up or Down arrow keys, or
click the cell you want.
6. When you view another record or close the table or form, Access saves the new
record that you added.
Delete a record
To select a record, click the record selector next to the record, if the record selector
is available.
To extend or reduce the selection, drag the record selector (if it is available), or
press SHIFT+DOWN ARROW or SHIFT+UP ARROW.
3. Press DELETE, select Home > Records > Delete, or press Ctrl+Minus Sign (-).
II Answer in One Word
6.Which statement removes all table records including allocated table spaces?
A.Truncate
A. A field’s data type determines what type of data to be entered into a field.
The various data types in Access 2010 are
• Numeric (or) Number (or)integer Types – This data type stores numeric
information for performing calculations.
• Alphanumeric (or) short text (or) char (or) varchar Types –This data type is
used to store text or a combination of text and numbers.
• Date/time (or) Date –This data type is used to store date/time-based data.
*Varchar is a variable length string data type, so it holds only the characters
assigned to it.
A. Flat File:
In Flat file database
*data is stored in a single table.
*Usually suitable for less amount of data.
Eg:-Microsoft Excel
Relational Database:
In Relational Database
*Data is stored in multiple tables and the tables are linked using a common
field.
*Relational database is suitable for medium to large amount of data.
Eg:-Oracle, Microsoft Access
SQL COMMANDS
• Primary key definition: PRIMARY KEY ([comma separated column list]) For
example, if you would like to create a table using the Create statement,
type the following and click Run.
INSERT statement
Note :-
DELETE statement
• To delete one of the records in the table created earlier using delete
statement, type the following and click on Run:
Table Vendor
1. Create table EMP with field names (eid, ename, location, doa)
2. Add one more column “Salalary” to EMP table
3. Apply a primary key to suitable field
4. Insert 6 records
5. View eid, ename from the table
6. View all the records and fields of the employee whose Salary is greater
than 55,000
7. Update the location to Hyderabad of the EMP whose Salary is less than
80,000
8. Delete the records of the emp whose Salary is greater than 1,00,000
9. Create another table transport with 5 fields
10. Delete transport table
To create table :
Example : create table dps(sid number primary key, sname varchar(20), dob
date);
To alter table :
To delete table :
Note :-