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

Rdbms - One Shot

The document discusses database management systems and their advantages. It explains what a database and DBMS are and provides examples. It also describes how data is organized and structured in tables with rows and columns. Database servers and their role are defined as well.

Uploaded by

Ansh Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views

Rdbms - One Shot

The document discusses database management systems and their advantages. It explains what a database and DBMS are and provides examples. It also describes how data is organized and structured in tables with rows and columns. Database servers and their role are defined as well.

Uploaded by

Ansh Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Relational Database

Management System
in
Notes & Imp. Ques.
Session – 1
Appreciate the
Concept of Database
Management System
Base
3

➜ It is a DBMS software provided by apache


openoffice.
➜ It is used for creating and managing databases.
➜ Its file extension is .odb
4
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).
5
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
6

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.
7
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
8

of
Database
9

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.
10

Sharing of Data
» In a database, the users of the database
can share the data among themselves.
There are various levels of authorization
to access the data, and consequently
the data can only be shared based with
the authorized users.
11

Data Integrity
» Data integrity means that the data is
accurate and consistent in the database.
12

Data Security
» Only authorized users are allowed to
access the database and their identity is
authenticated using a username and
password.
13

Backup & 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.
14

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.
15

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.
16
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.
17
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.
Session – 2
Create and Edit
tables using Wizard
and SQL Commands
RDBMS
19

➜ 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 searchability, 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.
20

Database
Objects
21

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.
22

Columns / Fields / 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.
23

Rows / Records / 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.
24
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.
25
Creating 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
26
Creating Table using Wizard
➜ Click on Click on Tables > Use wizard to create table
➜ Select the fields, set datatypes, set primary key, click on
Finish
27

Datatypes
» 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:
» Numeric Types
» Alphanumeric Types
» Binary Types
» Date time
» Other Variable types
28

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
29

Alphanumeric Types
» LONGVARCHAR, VARCHAR, CHAR,
VARCHAR_IGNORECASE
30

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
31

Date Time Datatypes


» Binary 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.
32

Date Time Datatypes


» Binary 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
33

Other Datatypes
Name Description
Other/Object Stores serialized java objects
34

Table Data View Dialog Box


➜ Start typing the records in the table and
select File > Save Current record to save
data in the table.
Session – 3
Perform operations
on Table
36

Inserting Data in 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
37

Editing Records in 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.
38

Deleting Records in Table


» Select the data > right click on selected
data > select the Delete option
39

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
40

» 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 DD-MM-YYYY.
Referential Integrity
41

➜ 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
42

➜ 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
43

➜ 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
44

➜ 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.
45
Remove the Relationships
➜ The relationships applied on the tables can be removed
with the help of Delete option. Right Click on the
relationship thread and select Delete option.
Session – 4
Retrieve Data using
Query
Query
47

➜ 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
48

• 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.
SELECT Statement
49

• 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
50

➜ 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
51

➜ 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
52

➜ 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.
➜ We can type the SQL Commands in the Command to execute
space and click on Execute.
Update Statement
53

➜ 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;
Session – 5
Create Forms and
Reports
Form
55

➜ 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
56

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.
Report
57

➜ 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.
➜ Ways of Creating Report :
➜ There is only one way – Using Wizard
Important Questions !!
58

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?
10.What do you understand by data consistency?
11.A __________ is an organized collection of data.
Important Questions !!
59

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 !!
60

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 !!
61

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 !!
62

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?
36. How can we delete relationship between tables?
Important Questions !!
63

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.
42.State the purpose of Update Command with the help of
an example.
43.Write the syntax of Update Statement.
Important Questions !!
64

44. Write the Command to display the salary of all the


employees after decreasing by 10000 from the Table
– Employee.
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.
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.
Important Questions !!
65

50. __________ statement is used to remove one or more


records in a Database.
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 !!
66

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?
67

Thanks! Any questions?


You can find me on instagram @i_pratikkumar
& [email protected]

You might also like