0% found this document useful (0 votes)
27 views7 pages

imp ans

Msbte k scheme imp questions

Uploaded by

rajkirdath369
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)
27 views7 pages

imp ans

Msbte k scheme imp questions

Uploaded by

rajkirdath369
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/ 7

Instance :- The data stored in database at particular moment is called as instance of the database

Schema:- The design of database is called schema


Types of schema
Physical schema
1) The design of a database at physical level that is how the data stored in the blocks of storage is
described in this level
Logical schema
1) It is the design of database at logical level
2) Developers and database administrators work at this level
View schema
1) Refers to design of database at view level
2) This usually describes the end user interaction with database system
3) There may be multiple schema at view level

DDL commands are CREATE,ALTER , DROP , RENAME


CREATE :- create command is used to create the table in database
Syntax:- create table tablename
(column1 datatype(size),
Column 2 datatype (size),
Column 3 datatype(size),
--------------------------------
Column n datatype(size)
);

(write example of create table)

ALTER :-
1)alter table is used to modify structure of a table
2) we can add,delete or modify column
Syntax:- Alter table tablename
ADD column_name datatype(size);
(write example of alter table)

DROP:- drop table is used to delete table permanently from database


Syntax:- drop table tablename;
(write example of drop table)

RENAME:-alter table can be also be used to rename table


Syntax:- alter table tablename rename to new_name;
(write example of rename table)

DML commands are INSERT,UPDATE,DELETE


INSERT:- insert command is used to insert one or more records in the table
Syntax:- Insert into table_name
Values(value1,value2,……,value n);
(write example of insert values in table)

UPDATE:-
1)Sometimes change in database become necessary
2) To make change in database update command is used
Syntax:- UPDATE table_name set column_name=new_value[where condition];
(write example of update values in table)

DELETE:- the records from exisiting table can be removed using delete command
Syntax:- DELETE from table_name;
(write example of delete values in table)
Strong entity:-
1) if an entity having its own key attribute specified then it is a strong entity
2) Key attribute is ued to identify that entity among set of entities in entity -set
3) Strong entity is denoted by single rectangle

Example:- (draw example)

Weak entity:-
1) The entity which does not have any key attribute is known as weak entity
2) Weak entity depends on strong entity
3) It is denoted is double rectangle

Example :- (draw example)

Domain:-
1) Every attribute has some pre-defined values scope known as attribute domain
2) This attribute domain decides which types of values are premitted in the attribute

Attribute:-
1) An attribute is a characteristics of an entity
2) It is column of a table
3) Every attribute is attached with specific data type which decides that which type of value can be
inserted in those attributes
4) Attributes are also known as fields

Database:-
1) collection of related data is called as database
2) Database is considered as collection of tables

Hierarchical model:-
1) A data model in which data is organized into a tree structure is known as hierarchical model
2) It is a top bottom approach
3) The data is stored in form of records . These records are connected to each others
4) It contains parent child relationship where parent is root of tree which then branches into the
children
(draw diagram for example)

Primary Key:-
1) Primary key uniquely identified each entity in the entity set
2) It must have unique values and cannot hold null values
3) Example:- in student table s_id is considered as primary key because it cannot hold same values

Candidate Key:-
1) Candidate key is formed by collection of attributes which hold unique value
2) The attribute which do not contain duplicate values may be a candidate key
3) It is a combination of two key attributes
4) Example:- in student data base with attribute s_regid ,s_rollno , s_name,address
The candidate keys are:-
{s_regid}
{s_rollno}
{s_regid,s_rollno}
Foreign Key:-
1) The foreign key is called as reference key
2) In this constraint one field is common in between two tables
3) Foreign key represent relationship between tables

Adavntages of DBMS over file processing system


1) Controlling data redundancy:-
A) In file processing system we have two files of same name so we are not able to update the data
due to duplicate file
B) Database does not allow us to create duplicate copies so we can update the data easily

2) Sharing of data
A) In file processing system there is limit to share the data
B) In DBMS data can be easliy shared by different application
C) Database administrator manages the data and gives right to user to access the data

3) Data Independence
A) In file processing system the file is dependent on particular semicolon,format
B) In DBMS there is no need of particular format
C) If changes are made in structure of database then there is no need to make changes in the program
D) This is called as data independence

4) Security:-
A) In DBMS the different user can have different level of access of data based on their roles
B) We can provide password to database

Data abstraction:- Extracting the important data and ignoring the irrelevant data is called as data
abstraction
Three level of data abstraction
1) Physical level:-
A) In data abstraction physical level is the lowest level
B) It describes how the the data is actually stored in the physical memory
C) The data is stored in the hard disk

2) Logical level:-
A) This is the next higher level of data abstraction
B) The data is abstracted from the physical level
C) Database administrators use the logical level of abstraction to decide what information to keep
in database

3) View level:-
A) It is the highest level of data abstraction
B) This level describes the user interaction with database system
C) We can view the database we cannot make any changes in database
D) Multiple views can be created for same database for multiple user
Relational model:-
1) Tables are used to represent the data and their relationship
2) Tables is a collection of rows and columns
3) Tables are also known as relations
4) Record are known as tuples and fields are known as attribute
5) (draw table and explain the table)

Normalization:-
1) Normalization is a database design technique which is used to organize the table in such manner
that it should reduce redundancy and dependency of data
2) It divides larger tables to smaller table and links these smaller table using their relationship
3) Normalization is a multi step process

2NF:-
1) Prime attribute:-
A) An attribute which is a part of the prime key is known as prime attribute
2) Non Prime attribute:-
A) An attribute which is not a part of the prime key is said to be a non prime attribute
3) As per the rule of Second Normal Form every non prime attribute must be dependent upon the
prime attribute

Consider the table


S_ID PROJ_ID S_name PROJ_NAME
S101 P1 Kunal Banking System
S102 P2 Radhika Library Management
S103 P3 Kiran Speech to Text converter
S104 P4 Jay ATM

Convert the table in 2NF


STUDENT
S_ID S_name PROJ_NAME
S101 Kunal Banking System
S102 Radhika Library Management
S103 Kiran Speech to Text converter
S104 Jay ATM

PROJECT
PROJ_ID PROJ_NAME
P1 Banking System
P2 Library Management
P3 Speech to Text converter
P4 ATM

Create table Employee


(
E_no number(10)NOT NULL,
E_name varchar(20)NOT NULL,
Dept_name varchar(25)NOT NULL,
Salary decimal(7,2)NOT NULL,
Joining_date date NOT NULL
);
Display the table
Desc Employee;

Alter table Employee


ADD PRIMARY KEY(E_no);

Display the table


Desc Employee;

Insert into Employee


Values(101,’Abc’ , ‘HR’, ‘15000.5’,’1999-04-21’);
1 row created

Insert into Employee


Values(102,’Efg’ , ‘TL’, ‘16000.5’,’1998-04-20’);
1 row created

Insert into Employee


Values(103,’Xyz’ , ‘Manager’, ‘20000.10’,’1994-09-22’);
1 row created

Display the values


Select *
From Employee;
(Show the values inserted in the form of table)

Disadvantages of file processing system


1) Data Redundancy
A) In this two files can be saved using same name
B) It means the data gets duplicated
C) This duplication of data in various file is termed as data redundancy
2) Data Inconsistency
A) When data is to be updated the data redundancy may lead to data inconsistency
B) It occurs when the data is not updated in the particular file

3) Difficulty in Accessing Data


A) The need of data access varies time to time
B) Different types of information is needed at different situation

4) Limited Data Sharing


A) It is difficult to share data in file system
B) There is a limit to share a file
C) To share data we have to write complex program

5) Atomicity Problem
A) Failure in a computer system may occur any time
B) When failure occurs if any transaction is in its midway than it may lead to some incorrect data
updation in system

SELECT * FROM Table 1


UNION
SELECT * FROM Table 2
E_id E_name
1 xyz
2 Pqr
3 Abc
In UNION operator we combine two tables and duplicate rows is not combined

SELECT * FROM Table 1


UNION ALL
SELECT * From Table 2

E_id E_name
1 xyz
2 Pqr
2 Pqr
3 Abc

In UNION ALL we combine two table tables and duplicate rows is also combined

SELECT * FROM Table 1


INTERSECT
SELECT * FROM Table 2
E_id E_name
2 Pqr

In INTERSECT we combine two tables and only common rows is combined


SELECT * FROM Table 1
INTERSECT ALL
SELECT * FROM Table 2
E_id E_name
2 Pqr
2 Pqr
In INTERSECT ALL we combine two tables and common values are displayed

SELECT * FROM Table 1


MINUS
SELECT * FROM Table 2

You might also like