0% found this document useful (0 votes)
6 views45 pages

Unit 1

Class 12 computer science unit 1 notes.

Uploaded by

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

Unit 1

Class 12 computer science unit 1 notes.

Uploaded by

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

Contents

Chapter 1-Database Management System( DBMS)


Chapter 2- Data Communication and Networking
Chapter 3- Web Technology II
Chapter 4- Programming Concept- C
Chapter 5- Object Oriented Programming-OOP
Chapter 6- Software Process Model (SPM)
Chapter 7- Recent Trends in Technology
Unit 1- Database Management System
Q. Define data, information, database and DBMS.
Data: Data are raw facts which are composed of alphabets, digits
and other symbols. It may or may not give any sense. For example:
1, Rubina, 5.4, 2, Roshan etc.

Information: When data are processed using a database program


or software, they are converted to the meaningful result, called
information.
In other words, the output of data processing is called information.
Example: information about height of 3 students.
Height of 3 students
SN Name Height
1 Rubina 5.4
2 Roshan 5.6
3 Sagar 6.3
Database:
A database is a collection of interrelated data of certain place
or person or things in such a way that it can be easily access (use) by
an application program like DBMS. A database contains records and
fields. A record is a collection of different types of information about
the same subject. There are two types of database. i. Manual database
ii. Computerize database.
Database Name: STUDENTS
SN Name Address Gender Phone
1 Rubina Hasanpur Female 091522121
2 Roshan Taranagar Male 9858422323
Fundamentals of Database:
Let us take the example of the following table of some students. The combination
of these cells is called Table.

Roll No. Name English Nepali Science Math S. Std Total


1. Susmita 78 56 78 90 90 392
2. Kamal 67 78 90 91 89 415
3. Amrit 56 45 55 78 80 314
4. Aakash 67 78 85 90 90 410
5. Shasank 78 56 80 90 70 374

DBMS(Database Management System):


Database Management System is a software that manages the
data stored in a database. This is a collection of software which is used to store
data, records, process them and obtain desired information. Since, data are very
important to the end users, we must have a good way of managing data.
In another word,
A DBMS is a collection of programs that manages the database
structure and controls access to the data stored in the database. The DBMS
make it possible to share the data in the database among multiple
applications or users. The DBMS stands between the database and the user.
The most common database management systems used in early
time were DB2, DBASEIII, DBASEIII+, FOXPRO,Ms-Access, Oracle, Clippers,
My SQL, My SQL server , Sybase etc.
Q. What are the function of database?
Ans: The functions of database are:
1. To store, manipulate and manage the information.
2. To reduce the repeated storage of the data (data redundancy) and improve
the disk optimization.
3. To keep latest and correct information (Data Consistency).
4. To computerize the data managing and processing system.
5. To provide data validation facilities.
6. To improve data security system.

Q. What are the major activities of database?


Ans: The major activities of database are:-
i. Adding new file to the database.
ii. Removing files from the database.
iii. Inserting data into the database file.
iv. Updating existing database file.
v. Deleting data from database file.
Q. What are the advantages and disadvantages of DBMS?
Ans: The advantages of DBMS are:
i. Sharing of data
ii. Easy in accessing data.
iii. Reduce data redundancy (duplicate).
iv. Improve backup and recovery.
v. Data security.
vi. Provide multiple user interface.

The disadvantages of DBMS are:


i. It is very expensive for large computer system.
ii. It is complex to understand and implement.
iii. It is fast changing technology.
iv. Failure in one part of the system can make the entire system
inactive.
v. Proper training is required for staff to work properly in the
database system.
Q. Explain different database models with merits and demerits.
Ans: The different database models are:
i. Hierarchical Database Model.
ii. Network Database Model
iii. Relational Database Model

i. Hierarchical Database Model: It is one of the oldest type of database


model. In this model, data is represented in the form of records. All
records is arranged in database as tree like structure. It supports one-
to-one and one-to-many relationship. The main disadvantage of
hierarchical model is to increase redundancy.
Merits:
1. It is the easiest model.
2. It has one or more attribute (field).
3. The searching is fast and easy, if parent is known.
4. It supports one-to-one and one-to-many relationship.

Demerits:
5. It is old fashioned, outdated database model.
6. It does not support many-to-many relationship.
7. The dependency on parent node is not beneficial always.
8. It increases redundancy because same data is to be repeated in
different places.
ii. Network Database Model: The network model replaced hierarchical
model due to some limitation on the model. Suppose an employee relates
to two departments then the hierarchical model cannot able to arrange
records in proper place. So, network database model was emerged
(appear) to arrange non-hierarchical database. The structure of database is
more like graph rather than tree structure. The main limitation of this
model is less security.

Merits:
1. It accepts many-to-many relationship, so it is more flexible.
2. The searching is faster.
3. The network model is simple and easy to design.
4. It reduces redundancy.

Demerits:
5. It is difficult to handle the relationship in complex program.
6. There is less security because of sharing data.
7. It increases the processing overhead(tension) due to the complex
relationship.
Fig. Network Model

iii. Relational Database Model: In RDBMS, the data is


organized into tables i.e. rows and columns. These tables
are called relations. In this model, normalization of the
database is possible. It is more complex and need more
powerful hardware computer and data storage devices.
Merits:
1. The breaking of complex database table into simple database
table becomes possible.
2. Database processing is faster than other model.
3. There is very less redundancy (repetition of data).
4. The integrity(accurate) rules can be easily be implemented.

Demerits:
5. It is more complex than other models.
6. There are too many rules because of complex
relationships(tables).
7. It needs more powerful computers and data storage devices.
Fig. Relational Database model
Entity Relationship Model : The entity relationship model (ER model) is based on a
perception(opinion or view or observation) of a real world object or entity. The diagrammatic
representation of entities, attributes and their relationship is described by ER- diagram. The E-R
diagram is an overall logical structure of a database that can be expressed graphically.

1. Entity: An entity is a “thing” or “object” in the real world. For example , if student is an entity,
is identified by registration number. It is represented by rectangle.

student

2. Attribute: Attributes are properties possessed by an entity or relationship. For e.g. std_no,
std_name, std_sub are the attributes of the entity student. Attribute is represented by oval
or ellipse.
Roll no

3. Relationship: A relationship is an association among several entities and represents


meaningful dependencies between them. For e.g. the association between teachers and
students is teaching. It is represented by diamond.

Teach

4. Lines: The flow of information is indicated by the lines in ER-diagram. It is simply a line. It is a
connector of entities, attributes and relationship.
Example of ER-diagram:

Name ID Name

Address

Teacher Teach student

Subject
Class Faculty

Fig. Entity Relationship Diagram


Q. Define the following terms:
1. Schema: Schema is the structure of a table i.e. it defines name of a
table and data fields.

2. Instance : Instance is interrelated data values in a record.


3. Primary Key: The field that contain the unique value can be set as
primary key. It does not permit to duplicate or null value.

4. Foreign Key: An attribute/properties of one entity whose values


depends on the primary key of another entity is called foreign key.
5. Record: A row in a table is called record. It contains information about
person, events or thing etc. it is also called tuple.

6. Field: A column in a table is called field or attribute. It contains


specific piece of information within a record. Its another name is
domain.
7. Table: A table is the arrangement of rows and columns. Each table
must have unique name and must be simple.
8. Objects: Objects are used in database to store data. So, object holds
data for manipulation and display it in the proper format. Main
components(parts) of DBMS are fields, record and table. Example :
components of objects are:
Height of students
SN Name Height(Feet, inch)
1 Rubina 5.2
2 Roshan 5.4
3 Sagar 6.3
9. Alternate Key: Alternate Key is a column or group of columns in a
table that uniquely identify every row in that table.

10. Candidate key: Candidate Key is a set of attributes that uniquely


identify tuples(rows) in a table. Candidate Key is a super key with no
repeated attributes.
Q. Who is DBA or DA? What are the major responsibilities of DA?
Ans: A Database Administrator (DBA) is individual or person
responsible for controlling, maintenance, coordinating, and operation
of database management system. Managing, securing, and taking
care of database system is main responsibility.
Major responsibilities are:
• Managing Data Integrity(truth or accurate), security and privacy of
data.
• Database design.
• Perform backup and recovery.
• Managing database users and provide security.
• Provides help and support to user.
• Decides content of the database.
• A DBA monitors the CPU and memory usage.
• DBA who have the duty of deciding which hardware devise will suit
the company requirement.
Q. Define SQL.
Ans: SQL stands for Structured Query Language. It is an international
standard database query language for accessing and managing data in the
database. SQL was introduced and developed by IBM in early 1970’s. SQL is
the standard language for Relational Database System such as MySQL, MS
Access, Oracle, Sybase, Informix etc. SQL is not a complete programming
languages, it is only used for communicating with database. SQL is a
language to operate databases. It includes database creation, deletion,
fetching rows, modifying rows, etc. SQL is an ANSI (American National
Standards Institute) standard language, but there are many different
versions of the SQL language. SQL pronounced as “See’-’Quell” is made of
three sub language DDL, DML and DCL (These languages are called DBML-
Database Management Language).
E.g.1.
To create a table
Syntax:
CREATE table_name(field1 data_type, field2 data_type,…….);
E.g.
CREATE student(sid number(4), name char(25));

E.g.2.
To insert records into a table student
Syntax:
INSERT into table_name
VALUES(List of values);
E.g.
INSERT into student
VALUES(22,’RAM’);
E.g.3
To select data from table
Synatx:
SELECT field1, field2,………FROM table_name
E.g.
SELECT sid,name FROM student
i) Data Definition Language(DDL): DDL is used by the database
designers and programmers to specify the contents and structure of
the table. It includes created or deleted tables , link between tables
etc.
DDL statements are: CREATE TABLE, ALTER TABLE, DROP , RENAME
TABLE .

E.g.1.
To create a table
Syntax:
CREATE table_name(field1 data_type, field2 data_type,…….);
E.g.
CREATE student(sid number(4), name char(25));
ii) Data Manipulation Language(DML): DML is related with
manipulation of records such as retrieval , sorting, display and
deletion of records or data. It includes insert, delete and update.
E.g.2.
To insert records into a table student
Syntax:
INSERT into table_name
VALUES(List of values);
E.g.
INSERT into student
VALUES(22,’RAM’);

iii) Data Control Language(DCL): DCL provides additional features for


security of database. It control data and access to the database.
Examples of DCL commands include: GRANT( Permission) REVOKE
(Deny) .
SQL statements for creating, dropping and altering database and table
E.g.
Creating database
Syntax:
CREATE DATABASE database_name;

E.g.
CREATE DATABASE class12;

E.g.
Dropping(deleting) the database
Syntax:
DROP DATABASE database_name;

E.g.
DROP DATABASE class12;
Altering table( adding, deleting or modifying columns in an existing
table)
E.g. E.g.
Adding column Modifying column
Syntax: Syntax:
ALTER TABLE table_name ALTER TABLE table_name
ADD column_name datatype; MODIFY COLUMN column_name datatype;
E.g. E.g.
ALTER TABLE student ALTER TABLE student
ADD E-mail varchar(255); MODIFY COLUMN salary int;

E.g.
E.g.
Deleting column
Deleting table
Syntax:
Syntax:
ALTER TABLE table_name
DROP TABLE table_name;
DROP column_name datatype;
E.g.
E.g.
DROP TABLE student;
ALTER TABLE student
DROP E-mail varchar(255);
Some other SQL statement:

E.g.
Selecting data
Syntax:
SELECT column1,column2,…FROM table_name;
E.g.
SELECT * FROM student; (all column)
SELECT Roll,name FROM student; (only roll and name will be select)

E.g.
Deleting data
Syntax:
DELETE FROM table_name WHERE condition;
E.g.
DELETE FROM student WHERE name=‘Shyam’;
Q. What is normalization? Explain the types of normalization in brief.
Ans: Normalization:
Database normalization, or simply normalization, is the
process of organizing the columns (attributes) and tables (relations)
of a relational database to reduce data redundancy and improve
data integrity (accurate). It was first proposed by Dr. Edgar F. Codd,
as an integral part of a relational model. He had introduced few
rules for normalizing the database in 1970 A.D.
The types of normalization are as follows:
i. First Normal Form(1NF)
ii. Second Normal Form(2NF)
iii. Third Normal Form(3NF)

Table: Students
Name Roll no Class Sub1_Name Sub1_Marks Sub2_Name Sub2_Marks
Ram 1 XI computer 90 Account 95
Man 1 XII Computer 95 Account 93
Hari 2 XI computer 85 Account 85
Alok 2 XII computer 96 Account 94

Fig. Un-normalized Form

i. First Normal Form(1NF): 1NF eliminates duplicative columns from the


same table.
Table: Students
Name Roll no Class Sub _name Sub_marks
Ram 1 XI computer 90
Ram 1 XI Account 95
Man 1 XII Computer 95
Man 1 XII Account 93
Hari 2 XI computer 85
Hari 2 XI Account 85
Alok 2 XII computer 96
Alok 2 XII Account 94

Fig. 1NF

ii. Second Normal Form(2NF): 2NF further addresses the concept of


removing duplicative data. It should be in the First Normal Form(1NF).
Table1: Student Table2:Subject
Name Roll Class Sub Name Class
Ram 1 XI Computer XI
Man 1 XII Account XI
Hari 2 XI Computer XII
Alok 2 XII Account XII

Table3: Marks
Name Sub-Name Sub-Marks
Ram Computer 90
Ram Account 95
Man Computer 95
Man Account 93
Hari Computer 85
Hari Account 85
Alok Computer 96
Alok Account 94

Fig. 2NF
iii)3NF: 3NF goes one large step further:
-It should be in the 2NF.
-It removes column that are not depend upon the primary key.
Table1:Student Table2:Subject
SID Name Roll CID SubID Sub_Name

1 Ram 1 11 C1 Computer
2 Man 1 12 A1 Account
3 Hari 2 11
Table4:Marks
4 Alok 2 12 Name Sub-Name Sub-Marks
Ram C1 90
Table3:Class Ram A1 95
CID Class Man C1 95
11 XI Man A1 93
12 XII Hari C1 85
Hari A1 85
Fig. 3NF Alok C1 96
Alok A1 94
Q. Why is normalization needed?
Ans: Normalization is needed because to reduce data redundancy, make
database more flexible and easier to maintain.

Q. Write down the advantages and disadvantages of normalization.


Ans: Advantages
1)Avoids data modification(change).
2)Greater flexibility in getting the expected data.
3)To reduce data redundancy
4)A better handle on database security.
5)Increased storage efficiency.
Disadvantages:
1)Requires much more CPU, memory, and I/O to process thus
normalized data gives reduced database performance.
2)Requires more link to get the desired result. A poorly-written query
can bring the database down.
3)Maintenance overhead. The higher the level of normalization, the
greater the number of tables in the database.
Q. Differentiate between centralized and distributed database system.
Ans: The differences between centralized and distributed database system
are:
Centralized database Distributed database
i. Centralized database system is simple. i. Distributed database system is
complex.

ii. They are located in particular location. ii. They are located in many geographical
location.

iii. It doesn’t contain server at several iii. It contain server at several location.
location.

iv. It is only suitable for small iv. It is suitable for large organization.
organization.

v. There is less chances of data loss. v. There is more chances of data hacking,
theft and lost.

vi. Maintenance is easier. vi. Maintenance is not easier.


vii. Cost is low. vii. Cost is high.
Fig. centralized database
Q. What is data security?
Ans: Data security is one of the challenging jobs of Database
Administrators (DBA). The secured data can be transferred from one
server to another server at great distances. For the prevention of
data piracy and data mining, proper securities are necessary to be
implemented in the system. The two common methods of data
security are using the username and password. The username
authentication and password verification can allow for data access.
So, data security is a preventive measures that a Database
Administrator (DBA) must take for the protection of data from the
unauthorized access, theft, corruption, etc.
Data security method:
• Using proper backup in hard disk, CD etc. provide security.
•Making physical prevention by using stabilizer and UPS to supply
regular power.
•Using strong password protection system.
•By Keeping the system under lock or safe place.
Q. Why data security is important?
Ans: The data that the company creates, collects, stores, and
exchanges is a valuable asset. It is most important for any
organization. Safeguarding it from corruption and unauthorized
access by internal or external people protects the company from
financial loss, reputation damage, brand decompose.

Q. Describe different method to protect database of an organization?


Ans: The different method to protect database of an organization are:
1. Authentication
2. Access control
3. Encryption
4. Backup and recovery
1. Authentication:
Authentication is the process of confirmation that whether the user log
in only according to the rights provided to him to perform the activities
of database. By using these authentication tools for biometrics such as
retina and finger prints can prevent the data from unauthorized/
malicious users.

2. Access Control:
The security mechanism of DBMS must include some provisions for
restricting access to the database by unauthorized users. Access control
is done by creating user accounts and to control login process by the
DBMS.
3. Encryption :
This method is used to protect sensitive data (such as credit card
numbers) OTP (One Time Password) numbers and other sensitive
numbers.

4. Backup and recovery:


A data backup entails making copy of your data and storing it on a
separate or medium such as tape, disk, pen drive or in the cloud. You
can then recover lost data by using your backup.
Microsoft-Access
DBMS concept
Data Type Description
An AutoNumber field creates unique values automatically when Access
AutoNumber creates a new record. The AutoNumber field is primarily used for Primary
Keys in Access.
A Text field can contain values that are text, numeric or a combination of
Text
both. A text field can contain a maximum length of 255 characters.
A much larger version of the text field, allowing storage of up to 2 GB of
Memo data. A new feature of the Microsoft Access Memo field is that it now
supports rich text formatting.
Number The Number field can store numeric values up to 16 bytes of data.

The Date/Time field allows storage of date and time information. The
Date/Time
date/time field now also includes the Auto Calendar feature.
The Currency data type stores values in a monetary format. This can be
Currency used with financial data as 8-byte numbers with precision to four decimal
places.
Yes/No Boolean data storage of true/false values.
The OLE Object field stores images, documents, graphs etc. from Office
OLE Object and Windows based programs. The maximum data size is 2 GB, although
this will slow down a database.
The Hyperlink field type is used to store web addresses. This has a
Hyperlink
maximum size limit of 1 GB of data.
The Attachment field type is used to store images, spreadsheet files,
documents, charts and other types of supported files to the records in
Attachment
your database. This is a new feature that has been introduced with
Microsoft Access 2007.
THANK YOU

You might also like