Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Dbms Questions Addon

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Unit1:

Ques3: Differentiate between Traditional File System and DBMS.

Ans: There are following differences between file system and DBMS:
File System     Database Management System (DBMS)

1. It is a software system used for creating


1. It is a software system that manages
and managing the databases. DBMS
and controls the data files in a
provides a systematic way to access,
computer system.
update, and delete data.

2. File system does not support multi- 2. Database Management System supports
user access. multi-user access.

3.  Data consistency is less in the file 3. Data consistency is more due to the use
system. of normalization.

4. Database Management System is highly


4. File system is not secured.
secured.

5. File system is used for storing the 5. Database management system is used
unstructured data. for storing the structured data.

6. In the file system, data redundancy is


6. In DBMS, Data redundancy is low.
high.

7. No data backup and recovery 7. There is a backup recovery for data in


process is present in a file system. DBMS.

8. Handling of a file system is easy. 8. Handling a DBMS is complex. 

9. Cost of a file system is less than the 9. Cost of database management system is
DBMS. more than the file system.

10. If one application fails, it does not 10. If the database fails, it affects all
affect other application in a system. application which depends on it.

11. In the  file system, data cannot be


11. In DBMS, data can be shared as it is
shared because it is distributed in
stored at one place in a database.
different files.

12. These system does not provide 12. This system provides concurrency
concurrency facility. facility.

13. Example: NTFS (New technology 13. Example: Oracle, MySQL, MS SQL


file system), EXT(Extended file system) Server, DB2, Microsoft Access, etc.
Ques8: Differentiate between Schema and Database.
Ans: Difference between Schema and Database
Database:

Database may be a common term in today’s life. several enterprises, firms,


organization, institutes, etc. needs a system to store their information in a very well-
formatted type in order that it might be simple to retrieve a helpful data out of it.
Whereas planning a information.

Schema:

Schema is such that describes the structural read of a information that confirms the
tables that will be concerned in making a information, the table’s attributes and their
association.

S.N SCHEMA DATABASE


O
1. Schema may be a structural read The info or database may be a
of a info or database. assortment of reticulate knowledge.
2. Schema once declared mustn’t Knowledge during a info or database
be changed often. keeps on change all time, therefore
database or info modifies often.
3. In schema, Tables name, fields Database or info includes such schema,
name, its sorts as well as records, and constraints for the
constraints are included. information.
4. For an info, Schema is specified In a database, The operations such as
by DDL. updates and adds are done using DML.

Ques9: What are the various types of users supported by a DBMS?

Ans: Database users are categorized based up on their interaction with the data base.
These are seven types of data base users in DBMS.
1. Database Administrator (DBA) :
Database Administrator (DBA) is a person/team who defines the schema and also
controls the 3 levels of database.
The DBA will then create a new account id and password for the user if he/she need
to access the data base.
DBA is also responsible for providing security to the data base and he allows only
the authorized users to access/modify the data base.
 DBA also monitors the recovery and back up and provide technical
support.
 The DBA has a DBA account in the DBMS which called a system or
superuser account.
 DBA repairs damage caused due to hardware and/or software failures.
2. Naive / Parametric End Users :
Parametric End Users are the unsophisticated who don’t have any DBMS
knowledge but they frequently use the data base applications in their daily life to
get the desired results.
For examples, Railway’s ticket booking users are naive users. Clerks in any bank is
a naive user because they don’t have any DBMS knowledge but they still use the
database and perform their given task.

3. System Analyst :
System Analyst is a user who analyzes the requirements of parametric end
users. They check whether all the requirements of end users are satisfied.

4. Sophisticated Users :
Sophisticated users can be engineers, scientists, business analyst, who are
familiar with the database. They can develop their own data base applications
according to their requirement. They don’t write the program code but they
interact the data base by writing SQL queries directly through the query
processor.

5. Data Base Designers :


Data Base Designers are the users who design the structure of data base which
includes tables, indexes, views, constraints, triggers, stored procedures. He/she
controls what data must be stored and how the data items to be related.
6. Application Program :
Application Program are the back end programmers who writes the code for the
application programs.They are the computer professionals. These programs
could be written in Programming languages such as Visual Basic, Developer, C,
FORTRAN, COBOL etc.

7. Casual Users / Temporary Users :


Casual Users are the users who occasionally use/access the data base but each
time when they access the data base they require the new information, for
example, Middle or higher level manager.

Ques10: What does anomaly mean?

Ans: The dictionary defines anomaly as “an abnormality.”


Ideally, a field value change should be made in only a single place.
Data redundancy, however, fosters an abnormal condition by forcing field value
changes in many different locations.
Anomalies in DBMS develops when not all of the required changes in the redundant
data are made successfully.

The Different Anomalies in DBMS:


 
1. Anomalies in DBMS: Update Anomalies
 
If agent Leah F. Hahn has a new phone number, that number must be entered in each
of the CUSTOMER file records in which Ms. Hahn’s phone number is shown. In this
case, only three changes must be made. In a large file system, such a change might
occur in hundreds or even thousands of records. Clearly, the potential for data
inconsistencies is great.

2. Anomalies in DBMS: Insertion Anomalies


 
If only the CUSTOMER file existed, to add a new agent, you would also add a dummy
customer data entry to reflect the new agent’s addition. Again, the potential for creating
data inconsistencies would be great.
 

3. Anomalies in DBMS: Deletion Anomalies


 If you delete the customers Amy B. O’Brian, George Williams, and Olette K. Smith, you
will also delete John T. Okon’s agent data. Clearly, this is not desirable.
Unit 4:

Ques9: There is a table where only one row is fully repeated. Write a Query to find
the Repeated row

Name Section
abc CS1
bcd CS2
abc CS1
In the above table, we can find duplicate row using below query.
Ans: In the above table, we can find duplicate row using below query

Name Section
abc CS1
bcd CS2
abc CS1
.
Ques10: Consider the following Employee table. How many rows are there in the
result of following query?
ID   salary   DeptName
1    10000      EC
2    40000      EC
3    30000      CS
4    40000      ME
5    50000      ME
6    60000      ME
7    70000      CS
How many rows are there in the result of following query?

Ans SELECT E.ID FROM  Employee E WHERE  EXISTS  (SELECT E2.salary


FROM Employee E2 WHERE E2.DeptName = 'CS' AND   E.salary > E2.salary)
Following 5 rows will be result of query as 3000 is the minimum salary of CS Employees
and all these rows are greater than 30000.
2
4
5
6
7
Ques 11: Why we cannot use WHERE clause with aggregate functions like
HAVING?

Ans: The difference between the having and where clause in SQL is that the where
clause canNOT be used with aggregates, but the having clause can. Please note : It is
not a predefined rule but by and large you’ll see that in a good number of the SQL
queries, we use WHERE prior to GROUP BY and HAVING after GROUP BY.
The Where clause acts as a pre filter where as Having as a post filter.
The where clause works on row’s data, not on aggregated data.
Let us consider below table ‘Marks’.
Student       Course      Score
a                c1             40
a                c2             50
b                c3             60
d                c1             70
e                c2             80
Consider the query

SELECT Student, sum(Score) AS total


FROM Marks
This would select data row by row basis. The having clause works on aggregated data.
For example,  output of below query
SELECT Student, sum(score) AS total FROM Marks
Student     Total
a             90
b             60
d             70
e             80
When we apply having in above query, we get
SELECT Student, sum(score) AS total
FROM Marks having total > 70
Student     Total
a             90
e 80
Ques12: the difference between CHAR and VARCHAR?

Ans:

CHAR and VARCHAR are both ASCII character data types and almost same but they
are different at the stage of storing and retrieving the data from the database. Following
are some important differences between CHAR and VARCHAR in SQL −

CHAR Data Type VARCHAR Data Type

Its full name is CHARACTER Its full name is VARIABLE CHARACTER

It stores values in fixed lengths and are VARCHAR stores values in variable length
padded with space characters to match along with 1-byte or 2-byte length prefix
the specified length and are not padded with any characters

It can hold a maximum It can hold a maximum of 65,535


of 255 characters. characters.

It uses static memory allocation. It uses dynamic memory allocation.


create table emp(name CHAR(20)); create table emp1(name VARCHAR(20));
Query OK, 0 rows affected (0.25 Query OK, 0 rows affected (0.21

You might also like