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

Typed Notes - RDBMS

This document provides an overview of relational database management systems (RDBMS) and database concepts such as tables, keys, data types, and creating and organizing data in a database using OpenOffice Base. It defines databases, database management systems, flat file and relational data organization, and database servers. It also describes database objects like tables, rows, columns, keys, and data types. Finally, it discusses creating databases and tables and inserting/editing data in tables in OpenOffice Base.

Uploaded by

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

Typed Notes - RDBMS

This document provides an overview of relational database management systems (RDBMS) and database concepts such as tables, keys, data types, and creating and organizing data in a database using OpenOffice Base. It defines databases, database management systems, flat file and relational data organization, and database servers. It also describes database objects like tables, rows, columns, keys, and data types. Finally, it discusses creating databases and tables and inserting/editing data in tables in OpenOffice Base.

Uploaded by

sharontt1810
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

IT 402 Class 10

RDBMS
Complete Chapter

Notes & Imp. Ques.


OpenOffice Base

● It is a DBMS software provided by apache openoffice.


● It is used for creating and managing databases.
● Its file extension is .odb
Database
● A database is an organized collection of data. You
can visualize it as a container of information. The
data is typically organized to model relevant
aspects of reality (for example, the availability of
rooms in hotels).
DBMS
● A database management system is a software package with
computer programs that controls the creation, maintenance,
and use of a database. It allows organizations to conveniently
develop databases for various applications. A database is an
integrated collection of data records, files, and other objects. A
DBMS allows different user application programs to
concurrently access the same database.
● Examples- Oracle, IBM DB2, Microsoft SQL Server, Microsoft
Access, PostgreSQL, MySQL, FoxPro, and SQLite
Organisation of Data
● Data can be organized into two types:
● Flat File: Data is stored in a single table. Usually
suitable for less amount of data.
● Relational: Data is stored in multiple tables and the
tables are linked using a common field. Relational is
suitable for medium to large amount of data.
Database Servers
● Database servers are dedicated computers that hold the
actual databases and run only the DBMS and related
software. Typically databases available on the database
servers are accessed through command line or graphic user
interface tools referred to as Frontends; database servers are
referred to as Back-ends. Such type of data access is referred
to as a client-server model.
Advantages
of Database
Reduces Data Redundancy

● There are sometimes multiple copies of the same


file which lead to data redundancy. This is
prevented in a database as there is a single
database and any change in it is reflected
immediately. Because of this, there is no chance of
encountering duplicate data.
Sharing of Data

● In a database, the users of the database can share


the data among themselves. There are various
levels of authorisation to access the data, and
consequently the data can only be shared based
with the authorized users.
Data Integrity & Security
● Data Integrity
● Data integrity means that the data is accurate and
consistent in the database.
● Data Security
● Only authorised users should be allowed to access the
database and their identity should be authenticated using a
username and password.
Backup and Recovery
● Database Management System automatically takes
care of backup and recovery. The users don't need
to backup data periodically because this is taken
care of by the DBMS. Moreover, it also restores the
database after a crash or system failure to its
previous condition.
Data Consistency
● Data Consistency means there should be multiple
mismatching copies of the same data. All data
appears consistently across the database and must
be same for all the users viewing the database.
Moreover, any changes made to the database are
immediately reflected to all the users and there is
no data inconsistency.
Features of Database
• A database can have one or many tables.
• Each table in a database contains information about one type of
item.
• When we put in information, we may have people with the same
name or the same address. But when creating a database an
important feature is record uniqueness in every table.
• Every database table should have one or more fields designated
as key. You can assign a unique value to this key for differentiating
records that may have similar names or addresses.
Keys
● Primary Key
● A primary key is a unique value that identifies a row in a
table. Primary Keys are also indexed in the database,
making it faster for the database to search for a record.
● Composite Primary Key
● When primary key constraint is applied on one or more
columns then it is known as Composite Primary Key.
Keys
● Foreign Key
● The foreign key identifies a column or set of columns in one
(referencing) table that refers to a column or set of columns
in another (referenced) table. The “one” side of a relation is
always the parent, and provides the PK attributes to be
copied. The “many” side of a relation is always the child, into
which the FK attributes are copied. Memorize it: one,
parent, PK; many, child, FK.
RDBMS
● A relational database is a collective set of multiple data sets
organized by tables, records and columns. Relational
database establish a well-defined relationship between
database tables. Tables communicate and share information,
which facilitates data searcheability, organization and
reporting.
● A Relational database use Structured Query Language (SQL),
which is a standard user application that provides an easy
programming interface for database interaction.
Database Objects
● Tables
● A table is a set of data elements (values) that is organized
using a model of vertical columns and horizontal rows. A
table has a defined no. of columns, but can have any no. of
rows.
● Columns or Fields or Attributes
● A column is a set of data values of a particular simple type,
one for each row of the table. The columns provide the
structure according to which the rows are composed. For
example, cFirstName, or cLastName are fields in a row.
Database Objects
● Rows or Records or Tuples
● A row also called a Record or Tuple represents a
single, data item in a table. In simple terms, a
database table can be visualized as consisting of
rows and columns or fields. Each row in a table
represents a set of related data, and every row in the
table has the same structure.
Creating Database
● Click Start>Programs>OpenOffice.org 4>OpenOffice.org Base.
● You can create a new database by selecting the option
Create a new database. You can also open an existing
database file that you have already created by selecting the
option Open an existing database file. Click Next.
● Click Finish. The Save As dialog box appears. Specify a name
for the database and click Save.
● Database has been created.
Creating a table in design view
● Click on Create Table in Design View… option
available under Tasks and a Table Design window
appears.
● Specify the field name and data type of the field to
be created by selecting the appropriate type
available under Field type dropdown list.
● Go to File > Save
Creating a table using wizard

● Click on Tables > Use wizard to create table


● Select the fields, set datatypes, set primary key, click
on Finish
Data Types
● Datatypes are used to identify which type of data (value) we
are going to store in the database. Fields themselves can be of
different types depending on the data they contain.
● Data types in OpenOffice base are broadly classified into five

categories:
i. Numeric Types
ii. Alphanumeric Types
iii. Binary Types
iv. Date time
v. Other Variable types
Numeric Types
● Numeric data types are used for describing numeric values for
the field used in the table of a database.
● Numeric data types in a database can be used for storing
information such as mobile number, roll number, door
number, year of school admission, true or false statements,
statistical values, etc.
Name Data Type Description
BOOLEAN Yes/No Values as 0 or 1 Example – Yes or
No
TINYINT Tiny Integer Store Integer Range between 0 to
255
Alphanumeric Types
● LONGVARCHAR, CHAR, VARCHAR, VARCHAR_IGNORECASE

Name Data Type Description


CHAR Text (Fix) Stores exactly the
length specified by
the user
VARCHAR Text Stores up to the
specified length
Binary Types
● Binary data types are used for storing data in
binary formats. Binary data types in a database can
be using for storing photos, music files, etc. In
general, files of any format can be stored using the
binary data type.
● Binary Types are - LONGBINARY, BINARY,
VARBINARY
Date Time
● Date time data types are used for describing date and time
values for the field used in the table of a database. Date time
data types in a database can be used for storing information
such as date of birth, date of admission, date of product sale,
etc.
Name Description Format
Date Stores month, day and year 1/1/99 to 1/1/9999
information
Time Stores hour, minute and second Seconds since 1/1/1970
information
Timestamp Stores date and time information
Other Data Types

Name Description
Other/Object Stores serialized java objects
Table data view dialog box
Start typing the records in the table and
select File > Save Current record to save
data in the table.
Inserting Data in the Table
● Select the table > Double click on it.
● The table will open in Datasheet View in which data
new data can be inserted and existing data can be
updated or removed

Editing Records in the Table


To edit the data either click on edit icon or double on
the data in the cell of a table and modifications can be
done.
Deleting Records in the Table
● Select the data > right click on selected data > select
the Delete option

Sorting Data
● Sorting means to arrange the data in either ascending
order or descending order.
● Select the column(s) then click on sort buttons. The
data will be displayed accordingly.
Field Properties
● Select the table > Right click > Select the option Edit > the table
Design View window will open.
● In design view there are different properties of fields according to
the data type set for each field.
● AutoValue – if set to yes then field will get the auto numeric values.
● Length – By default length of the field is 10 but the size of the field
can be set to maximum length.
● Default Value – A default value can be set for a field if user don‟t
provide any value while entering the values in the table.
● Format example – This property helps to set the format of the data
entered in the field such as 91-222-333.
Referential Integrity
● Referential integrity is used to maintain accuracy and consistency of
data in a relationship. In Base, data can be linked between two or
more tables with the help of primary key and foreign key constraints.
● Referential integrity helps to avoid:
● Adding records to a related table if there is no associated record
available in the primary key table.
● Changing values in a primary if any dependent records are present
in associated table.
● Deleting records from a primary key table if there are any matching
related records available in associated table.
Relationship between tables
● A relationship refers to an association or connection
between two or more tables. When we relate two tables,
we don't need to enter the same data in separate tables.
● Advantages of Relationship :
● Save time as there is no need to enter the same data in
separate tables.
● Reduce data-entry errors.
● Summarize data from related tables.
Relationship between tables
● Steps:-
● Tools > Relationships…

● Add the tables in amongst which you want to create the

relationship. Select the tables and click on Add button.


● Drag the primary key of one table and drop it on the

foreign key of the another table.


● Types of Relationships

1. ONE to ONE
2. ONE to MANY or MANY to ONE
3. MANY to MANY
Types of Relationships
● One to One Relationship
● In this relationship, both the tables must have primary key columns.
● One to Many Relationship
● In this relationship, one of the table must have primary key column.
It signifies that one column of primary key table is associated with all
the columns of associated table.
● Many to Many Relationship
● In this relationship, no table has the primary key column. It signifies
that all the columns of primary key table are associated with all the
columns of associated table.
Remove the Relationships

● The relationships applied on the tables can be


removed also with the help of Delete option.
Right Click on the relationship thread and select
Delete option.
Query
● Query is used to collect specific information from the pool of
data.
● A query helps us join information from different tables and
filter that information.
● Filtering means that the query uses criteria you provide to
hide some data and present only what you want to see.
Select Statement
● A SELECT statement retrieves zero or more rows from one or more
database tables or database views.
● In most applications, SELECT is the most commonly used Data Manipulation
Language(DML) command.
● The SELECT statement has many optional clauses:
● WHERE specifies which rows to retrieve.
● ORDER BY specifies an order in which to return the rows.
● To retrieve all the columns in a table the syntax is: SELECT * FROM
<TableName>;
● Example- Select * from SDetails;
● In order to execute queries click on the Queries option available on the left
side under database section, click Create Query in SQL View
Performing Calculations
● In Base, simple calculations can be done on the data using
arithmetic operators.
● Example: To display the salary of all the employees after
incrementing by 1000 then the following SQL command will be
executed in Base SQL Design.
● Select “EmployeeID”, “FirstName”, “Salary” +1000 from “Employee”;
● To display the salary of all the employees after decreasing by 10000
then the following SQL command will be executed in Base SQL
Design.
● Select “EmployeeID”, “FirstName”, “Salary” - 10000 from “Employee”;
Performing Calculations
● To display the salary of all the employees after incrementing it
as twice the amount of present salary, then the following SQL
command will be executed in Base SQL Design.
● Select “EmployeeID”, “FirstName”, “Salary” * 2 from
“Employee”;
● To display half of the salary amount paid to the employees,
then the following SQL command will be executed in Base
SQL Design.
● Select “EmployeeID”, “FirstName”, “Salary”/2 from “Employee”;
Grouping of Data
● To display the records containing the same type of values “WHERE” clause
can be used with the Select SQL Command.
● To get details about the list of students whose favorite color is blue, you can
use:
● select * from SDetails where Color=‟Blue‟;
● To view records in ascending order of RollNo, from the table the select
statement will be:
● select * from SDetails order by “Rollno” ASC;
● To type and execute SQL commands, click on Tools > SQL.
● A window will be displayed.
● You can type the SQL Commands in the Command to execute space and
click on Execute.
Update Statement
● Update statement is used for modifying records in a
database. The general syntax of the update statement
is as follows:
● UPDATE <TableName> SET <Column_Name> = value
[column_name = value ...] [WHERE <Condition> ];
● Update SDetails set Location = „Bhubaneswar‟ where
Rollno = 14;
Form
● A form provides the user a systematic way of storing
information into the database. It is an interface in a user
specified layout that lets users to view, enter, and change data
directly in database objects such as tables.

Options to enter data from forms


● You can add new records to the table using the form by clicking the
symbol located at the bottom.
● Once you click the symbol, you will be displayed with a window for
creating records.
● You can add records using the form.
Reports
● A report helps to display the data in a summarized
manner. It is used to generate the overall work
outcome in a clear format. You can create reports in
the database.
IMPORTANT QUESTIONS
1. What does DBMS stands for?
2. What does RDBMS stands for?
3. How is data organized in a RDBMS?
4. State the relationship and difference between a
primary and foreign key.
5. What are the features of a database?
6. What are the advantages of a database?
7. What is Flat File Data?
8. Write a short note on Database Management
System.
9. What is Composite key?
IMPORTANT QUESTIONS
10. What do you understand by data consistency?
11. A __________ is an organized collection of data.
12. A ________________ is a software package that can be
used for creating and managing databases.
13. A ____________ is a database management system
based on the relational model.
14. Three popular DBMS software are
________, ________, & _______.
15. A ____________ is a unique value that
identifies a row in a table.
16. Composite Key is a combination of ________ columns.
IMPORTANT QUESTIONS
17. A table is a set of data elements that is
organized using a model of vertical
___________ and horizontal ____________.
18. A _________ is a set of data values of a
particular type, one for each row of the table.
19. A ___________ represents a single, data item in
a table.
20. ____________ are used to identify which type of
data we are going to store in the database.
21. There are ________ ways to create a table.
IMPORTANT QUESTIONS
22. In how many ways tables can be created in
Base?
23. Why are data types used in DBMS /RDBMS?
24. List datatypes available in Numeric
Datatype?
25. List datatypes available in Alphanumeric
Datatype?
26. Define the structure of a table.
27. Differentiate between Tuples and Attributes
of a table.
28. Name different Binary data types.
IMPORTANT QUESTIONS
29. How can we insert data in a table?
30. How can we edit data in a table?
31. How can we delete a record in a table?
32. What is the length of field by default?
33. What is the file extension for databases created
using OpenOffice.Org Base?
34. Explain Referential Integrity with the help of an
example.
35. What are the advantages of relationship
between tables?
IMPORTANT QUESTIONS
36. How many types of relationships can be created
in Base? Explain each of the them.
37. What do you mean by Sorting? In how many
ways it can be done?
38. __________ are the basic building blocks of a
database.
39. What is the purpose of using queries?
40. Which clause of Select statement helps to
display specific data?
41. Differentiate between Where and Orderby
clause of SQL statements.
IMPORTANT QUESTIONS
42. State the purpose of Update Command with the
help of an example.
43. Write the Command to display the salary of all the
employees after decreasing by 10000 from the
Table – Employee.
44. Write the syntax of Update Statement.
45. What do you understand by the term „Filtering‟ ?
46. A ________ enables users to view, enter, and
change data directly in database objects such
as tables.
IMPORTANT QUESTIONS
47. _________ statement retrieves zero or more rows
from one or more database tables or database
views.
48. By default, data is arranged in _______ order
using ORDER BY clause.
49. __________ statement is used for modifying
records in a database.
50. __________ statement is used to remove one or
more records in a Database.
IMPORTANT QUESTIONS
51. A _______ helps the user to systematically store
information in the database.
52. To create a form you need to select _________
option available under Database section.
53. ________ is used to display the display the
summary of data.
54. _________ are the interfaces with which the user
interacts.
55. Data from multiple tables can be stored in
_______.
56. Why there is a need to create Forms?
IMPORTANT QUESTIONS
57. What is the purpose of creating Reports?
58. What are the prerequisites to create a Form
and Reports?
59. Differentiate between Forms and Reports.
60. Can a form display data from queries?
61. In how many ways Forms and Reports can be
created in a database?

You might also like