Saturday, August 11, 2018

Database Management System (Complementary)

Syllabus

Database Management System
Contact Hours per Week: 3 Theory Credit: 2

Module I
Introduction – Advantages of Database systems. View of Data, data Models,database system architecture, Field, Record, Entity, Attribute, Relation, Domain.

Module II
Data Base Users and administrators, Constraints, Keys (Candidate, Primary,Super, Foreign), Relational Algebra – Fundamental operations, E-R Model, E-R diagrams.

Module III
Normalization (First, Second, Third, BCNF), SQL: Introduction to SQL Tables –DDL, DML, DCL,Data types.

Module IV
Visual Basic: What is Visual Basic, Structure of a VB Application, Steps in developing Application, drawing the user interface and setting properties, setting properties of objects at design time and at runtime variables.

Module V
VB data types , variable declaration, VB operators and functions, Branching statements – if then , go to, select-case, Looping statements, Do-While-Loop, Do-Loop-While, Do-Until-Loop, Do-Loop-Until, While-wend, for-next, Arrays and control arrays.

Text book .
1.Data Base Concept 3rd edition Abraham Silberschatz, Henery f Korth McGraw Hill
2. A Guide to the SQL Standard, C. J. Date and Hugh Darwen, 1997, Addison-Wesley
3. Visual Basic 6, G Cornell, Tata McGraw Hill

Model Question Paper


3C03CSC – Database Management System
Time: 3 Hrs Max. Marks: 32
SECTION A
1. One word answer (6 x 0.5 = 3 marks)
a. …. Command is used to remove a table from database
b. ………clause is used to impose sorting on the query results
c. A relational database consists of a collection of…..
d. Multiline is the property of ……. control
e. Write the syntax of the msgbox
f. OLE stands for…..
SECTION B
Write short notes on ANY FIVE of the following questions (5 x 2 = 10 marks)
2. What is primary key?
3. Explain about insert command
4. Explain update command
5. Explain field , record and entity
6. Define use of DML
7. Define 2NF
8. What is the need of go to statement in VB?
9. Define a variable in VB

SECTION C
Answer ANY THREE of the following questions (3x 3 = 9 marks)
10. Explain the advantage of DBMS
11. Explain the components of SQL
12. Write a notes on three SQL commands with example
13. What is control array? Explain
14. Explain various do loop in VB

SECTION D
Write an essay on ANY TWO of the following questions (2 x 5 = 10 marks)
15. What do you mean by database administrator? Explain function of DBA
16. Explain E –R model in details
17. Explain various looping statements in VB with examples
18. What is meant by Normalization? Explain different types of normalization
with suitable examples.


---------------------------------------------------------------------------------------------------
Q.1 In the relational modes, cardinality is termed as:
(A) Number of tuples. (B) Number of attributes.
(C) Number of tables. (D) Number of constraints.
Ans: A

Q.2 Relational calculus is a
(A) Procedural language. (B) Non- Procedural language.
(C) Data definition language. (D) High level language.
Ans: B

Q.3 The view of total database content is
(A) Conceptual view. (B) Internal view.
(C) External view. (D) Physical View.
Ans: A

Q.4 Cartesian product in relational algebra is
(A) a Unary operator. (B) a Binary operator.
(C) a Ternary operator. (D) not defined.
Ans: B Cartesian product in relational algebra is a binary operator.
(It requires two operands. e.g., P X Q)

Q.5 DML is provided for
(A) Description of logical structure of database.
(B) Addition of new structures in the database system.
(C) Manipulation & processing of database.
(D) Definition of physical structure of database system.

Ans: C DML is provided for manipulation & processing of database.
(Data stored in the database is processed or manipulated using data manipulation
language commands as its name)

Q.6 ‘AS’ clause is used in SQL for
(A) Selection operation. (B) Rename operation.
(C) Join operation. (D) Projection operation.
Ans: B ‘AS’ clause is used in SQL for rename operation.
(e.g., SELECT ENO AS EMPLOYEE_NO FROM EMP)

Q.7 ODBC stands for
(A) Object Database Connectivity.
(B) Oral Database Connectivity.
(C) Oracle Database Connectivity.
(D) Open Database Connectivity.
Ans: D

Q.8 Architecture of the database can be viewed as
(A) two levels. (B) four levels.
(C) three levels. (D) one level.
Ans: C

Q.9 In a relational model, relations are termed as
(A) Tuples. (B) Attributes
(C) Tables. (D) Rows.
Ans:c

Q.10 The database schema is written in
(A) HLL (B) DML
(C) DDL (D) DCL

Ans: C

Q.11 In the architecture of a database system external level is the
(A) physical level. (B) logical level.
(C) conceptual level (D) view level.
Ans: D

Q.12 An entity set that does not have sufficient attributes to form a primary key is a
(A) strong entity set. (B) weak entity set.
(C) simple entity set. (D) primary entity set.
Ans: B

Q.13 In a Hierarchical model records are organized as
(A) Graph. (B) List.
(C) Links. (D) Tree.
Ans: D

Q.14 In an E-R diagram attributes are represented by
(A) rectangle. (B) square.
(C) ellipse. (D) triangle.
Ans: C

Q.15 In case of entity integrity, the primary key may be
(A) not Null (B) Null
(C) both Null & not Null. (D) any value.
Ans: A

Q.16 In tuple relational calculus P1 ®P2 is equivalent to
(A) ¬P1 Ú P2 (B) P1 Ú P2
(C) P1 Ù P2 (D) P1 Ù¬P2
Ans: A
In tuple relational calculus P1 P2 is equivalent to ¬P1 Ú P2.

 (The logical implication expression A B, meaning if A then B,is equivalent to ¬A Ú B)

Q.17 The language used in application programs to request data from the DBMS is referred
to as the
(A) DML (B) DDL
(C) VDL (D) SDL
Ans: A

Q.18 A logical schema
(A) is the entire database.
(B) is a standard way of organizing information into accessible parts.
(C) describes how data is actually stored on disk.
(D) both (A) and (C)
Ans: A

Q.19 Related fields in a database are grouped to form a
(A) data file. (B) data record.
(C) menu. (D) bank.
Ans: B Related data fields in a database are grouped to form a data record.
(A record is a collection of related fields)

Q.20 The database environment has all of the following components except:
(A) users. (B) separate files.
(C) database. (D) database administrator.
Ans: A

Q.21 The language which has recently become the defacto standard for interfacing application
programs with relational database system is
(A) Oracle. (B) SQL.
(C) DBase. (D) 4GL.

Ans: B

Q.22 The way a particular application views the data from the database that the application
uses is a
(A) module. (B) relational model.
(C) schema. (D) sub schema.
Ans: D

Q.23 In an E-R diagram an entity set is represent by a
(A) rectangle. (B) ellipse.
(C) diamond box. (D) circle.
Ans: A

Q.24 A report generator is used to
(A) update files. (B) print files on paper.
(C) data entry. (D) delete files.
Ans: B

Q.25 The property / properties of a database is / are :
(A) It is an integrated collection of logically related records.
(B) It consolidates separate files into a common pool of data records.
(C) Data stored in a database is independent of the application programs using it.
(D) All of the above.
Ans: D

Q.26 The DBMS language component which can be embedded in a program is
(A) The data definition language (DDL).
(B) The data manipulation language (DML).
(C) The database administrator (DBA).
(D) A query language.

Ans: B

Q.27 A relational database developer refers to a record as
(A) a criteria. (B) a relation.
(C) a tuple. (D) an attribute.
Ans: C

Q.28 The relational model feature is that there
(A) is no need for primary key data.
(B) is much more data independence than some other database models.
(C) are explicit relationships among records.
(D) are tables with many dimensions.
Ans: B

Q.29 Conceptual design
(A) is a documentation technique.
(B) needs data volume and processing frequencies to determine the size of the database.
(C) involves modelling independent of the DBMS.
(D) is designing the relational model.
Ans:C

Q.30 The method in which records are physically stored in a specified order according to a key
field in each record is
(A) hash. (B) direct.
(C) sequential. (D) all of the above.
Ans: A 
A method in which records are physically stored in a specified order according
to a key field in each record is hash.
(In hash method, a hash function is performed on the key value to determine the
unique physical address of the record to store or retrieve)

Q.31 A subschema expresses
(A) the logical view. (B) the physical view.
(C) the external view. (D) all of the above.
Ans: C A subschema expresses the external view.
(External schemas are called also called as subschemas)

Q.32 Count function in SQL returns the number of
(A) values. (B) distinct values.
(C) groups. (D) columns.
Ans: A Count function in SQL returns the number of values.
(Count function counts all the not null values in the specific column. If we want to
count only distinct values than the DISTINCT keyword is also to be used)

Q.33 Which one of the following statements is false?
(A) The data dictionary is normally maintained by the database
administrator.
(B) Data elements in the database can be modified by changing the data dictionary.
(C) The data dictionary contains the name and description of each data element.
(D) The data dictionary is a tool used exclusively by the database administrator.
Ans: B

Q.34 An advantage of the database management approach is
(A) data is dependent on programs.
(B) data redundancy increases.
(C) data is integrated and can be accessed by multiple programs.
(D) none of the above.
Ans: C

Q.35 A DBMS query language is designed to
(A) support end users who use English-like commands.
(B) support in the development of complex applications software.
(C) specify the structure of a database.
(D) all of the above.
Ans: D

Q.36 TrAnsaction processing is associated with everything below except
(A) producing detail, summary, or exception reports.
(B) recording a business activity.
(C) confirming an action or triggering a response.
(D) maintaining data.
Ans: C

Q.37 It is possible to define a schema completely using
(A) VDL and DDL. (B) DDL and DML.
(C) SDL and DDL. (D) VDL and DML.
Ans: B

Q.38 The method of access which uses key trAnsformation is known as
(A) direct. (B) hash.
(C) random. (D) sequential.
Ans: B

Q.39 Data independence meAns
(A) data is defined separately and not included in programs.
(B) programs are not dependent on the physical attributes of data.
(C) programs are not dependent on the logical attributes of data.
(D) both (B) and (C).

Ans: D both (B) and (C)

Q.40 The statement in SQL which allows to change the definition of a table is
(A) Alter. (B) Update.
(C) Create. (D) select.
Ans: A

Q.41 E-R model uses this symbol to represent weak entity set ?
(A) Dotted rectangle.
(B) Diamond
(C) Doubly outlined rectangle
(D) None of these
Ans: C

Q.42 SET concept is used in :
(A) Network Model
(B) Hierarchical Model
(C) Relational Model
(D) None of these
Ans: A

Q.43 Relational Algebra is
(A) Data Definition Language .
(B) Meta Language
(C) Procedural query Language
(D) None of the above
Ans: C

Q.44 Key to represent relationship between tables is called
(A) Primary key (B) Secondary Key

 (C) Foreign Key (D) None of these
Ans: C

Q.45 _______ produces the relation that has attributes of R1 and R2
(A) Cartesian product (B) Difference
(C) Intersection D) Product
Ans: A

Q.46 The file organization that provides very fast access to any arbitrary record of a file is
(A) Ordered file (B) Unordered file
(C) Hashed file (D) B-tree
Ans: C

Q.47 DBMS helps achieve
(A) Data independence (B) Centralized control of data
(C) Neither (A) nor (B) (D) both (A) and (B)
Ans: D

Q.48 Which of the following are the properties of entities?
(A) Groups (B) Table
(C) Attributes (D) Switchboards
Ans: C

Q.49 In a relation
(A) Ordering of rows is immaterial
(B) No two rows are identical
(C) (A) and (B) both are true
(D) None of these.
Ans: C

Q.50 Which of the following is correct:

 (A) a SQL query automatically eliminates duplicates.
(B) SQL permits attribute names to be repeated in the same relation.
(C) a SQL query will not work if there are no indexes on the relations
(D) None of these
Ans: D

Q.51 It is better to use files than a DBMS when there are
(A) Stringent real-time requirements.
(B) Multiple users wish to access the data.
(C) Complex relationships among data.
(D) All of the above.
Ans: B

Q.52 The conceptual model is
(A) dependent on hardware.
(B) dependent on software.
(C) dependent on both hardware and software .
(D) independent of both hardware and software.
Ans: D

Q.53 What is a relationship called when it is maintained between two entities?
(A) Unary (B) Binary
(C) Ternary (D) Quaternary
Ans: B

Q.54 Which of the following operation is used if we are interested in only certain columns of a
table?
(A) PROJECTION (B) SELECTION
(C) UNION (D) JOIN

Ans: A

Q.55 Which of the following is a valid SQL type?
(A) CHARACTER (B) NUMERIC
(C) FLOAT (D) All of the above
Ans: D

Q.56 The RDBMS terminology for a row is
(A) tuple. (B) relation.
(C) attribute. D) degree.
Ans: A

Q.57 Which of the following operations need the participating relations to be union compatible?
(A) UNION (B) INTERSECTION
(C) DIFFERENCEqq (D) All of the above
Ans: D

Q.58 The full form of DDL is
(A Dynamic Data Language (B) Detailed Data Language
(C) Data Definition Language (D) Data Derivation Language
Ans: C

Q.59 Which of the following is an advantage of view?
(A) Data security (B) Derived columns
(C) Hiding of complex queries (D) All of the above
Ans: D

Q.60 Which of the following is a legal expression in SQL?
(A) SELECT NULL FROM EMPLOYEE;
(B) SELECT NAME FROM EMPLOYEE;
(C) SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL;

 (D) None of the above
Ans: B

Q.61 The users who use easy-to-use menu are called
(A) Sophisticated end users. (B) Naïve users.
(C) Stand-alone users. (D) Casual end users.
Ans: B

Q.62 Which database level is closest to the users?
(A) External (B) Internal
(C) Physical (D) Conceptual
Ans: A

Q.63 Which are the two ways in which entities can participate in a relationship?
(A) Passive and active (B) Total and partial
(C) Simple and Complex (D) All of the above
Ans: B

Q.64 The result of the UNION operation between R1 and R2 is a relation that includes
(A) all the tuples of R1
(B) all the tuples of R2
(C) all the tuples of R1 and R2
(D) all the tuples of R1 and R2 which have common columns
Ans: D

Q.65 Which of the following is a comparison operator in SQL?
(A) = (B) LIKE
(C) BETWEEN (D) All of the above
Ans: D

Q.66 A set of possible data values is called
(A) attribute. (B) degree.
(C) tuple. (D) domain.
Ans: D

Q.67 Which of the operations constitute a basic set of operations for manipulating relational
data?
(A) Predicate calculus (B) Relational calculus
(C) Relational algebra (D) None of the above
Ans:C

Q.68 Which of the following is another name for weak entity?
(A) Child (B) Owner
(C) Dominant (D) All of the above
Ans: A

Q.69 Which of the following database object does not physically exist?
(A) base table (B) index
(C) view
(D) none of the above
Ans: C

Q.70 NULL is
(A) the same as 0 for integer
(B) the same as blank for character
(C) the same as 0 for integer and blank for character
(D) not a value
Ans: D

Q.71 Which of the following is record based logical model?

 (A) Network Model (B) Object oriented model
(C) E-R Model (D) None of these
Ans: A

Q.72 A data dictionary is a special file that contains:
(A) The name of all fields in all files.
(B) The width of all fields in all files.
(C) The data type of all fields in all files.
(D) All of the above.
Ans: D

Q.73 A file manipulation command that extracts some of the records from a file is called
(A) SELECT (B) PROJECT
(C) JOIN (D) PRODUCT
Ans: A

Q.74 The physical location of a record is determined by a mathematical formula that trAnsforms
a file key into a record location is :
(A) B-Tree File (B) Hashed File
(C) Indexed File (D) Sequential file.
Ans: B

Q.75 Using Relational Algebra the query that finds customers, who have a balance of over
1000 is
(A) PCustomer_name(s balance >1000(Deposit))
(B) s Customer_name(Pbalance >1000(Deposit))
(C) PCustomer_name(s balance >1000(Borrow))
(D) s Customer_name(Pbalance >1000(Borrow))
Ans: A

Q.76 A primary key is combined with a foreign key creates
(A) Parent-Child relation ship between the tables that connect them.
(B) Many to many relationship between the tables that connect them.
(C) Network model between the tables that connect them.
(D) None of the above.
Ans: A

Q.77 In E-R Diagram derived attribute are represented by
(A) Ellipse (B) Dashed ellipse
(C) Rectangle (D) Triangle
Ans B

Q.78 Cross Product is a:
(A) Unary Operator (B) Ternary Operator
(C) Binary Operator (D) Not an operator
Ans: C

Q.79 An instance of relational schema R (A, B, C) has distinct values of A including NULL
values. Which one of the following is true?
(A) A is a candidate key (B) A is not a candidate key
(C) A is a primary Key (D) Both (A) and (C)
Ans: B

Q.80 Consider the join of a relation R with relation S. If R has m tuples and S has n tuples,
then the maximum size of join is:
(A) mn (B) m+n
(C) (m+n)/2 (D) 2(m+n)
Ans: A

Q.81 The natural join is equal to :

 (A) Cartesian Product
(B) Combination of Union and Cartesian product
(C) Combination of selection and Cartesian product
(D) Combination of projection and Cartesian product
Ans: D

Q.82 Which one of the following is not true for a view:
(A) View is derived from other tables.
(B) View is a virtual table.
(C) A view definition is permanently stored as part of the database.
(D) View never contains derived columns.
Ans: C

Q.83 A primary key if combined with a foreign key creates
(A) Parent-Child relationship between the tables that connect them.
(B) Many to many relationship between the tables that connect them.
(C) Network model between the tables that connect them.
(D) None of the above.
Ans: A

Q.84 In E-R Diagram relationship type is represented by
(A) Ellipse (B) Dashed ellipse
(C) Rectangle (D) Diamond
Ans: D

Q.85 Hierarchical model is also called
(A) Tree structure (B) Plex Structure
(C) Normalize Structure (D) Table Structure
Ans: A

Q.86 To delete a particular column in a relation the command used is:
(A) UPDATE (B) DROP
(C) ALTER (D) DELETE
Ans: C

Q.87 The ______ operator is used to compare a value to a list of literals values that have been
specified.
(A) BETWEEN (B) ANY
(C) IN (D) ALL
Ans: A

Q.88 A logical schema
A) is the entire database
B) is a standard way of organizing information into a accessible part
C) describe how data is actually stored on disk
D) none of these
Ans: D

Q.89 A B-tree of order m has maximum of _____________ children
(A) m (B) m+1
(C) m-1 (D) m/2
Ans: A

Q.90 _____________ function divides one numeric expression by another and returns the
remainder.
(A) POWER (B) MOD
(C) ROUND (D) REMAINDER
Ans: B

Q.91 A data manipulation command the combines the records from one or more tables is called

 (A) SELECT (B) PROJECT
(C) JOIN (D) PRODUCT
Ans: C

Q.92 In E-R diagram generalization is represented by
(A) Ellipse (B) Dashed ellipse
(C) Rectangle (D) Triangle
Ans: D

Q.93 _________ is a virtual table that draws its data from the result of an SQL
SELECT statement.
(A) View (B) Synonym
(C) Sequence (D) TrAnsaction
Ans: A

Q.94 The method of access which uses key trAnsformation is known as
(A) Direct (B) Hash
(C) Random (D) Sequential
Ans: B

Q.95 A table joined with itself is called
(A) Join (B) Self Join
(C) Outer Join (D) Equi Join
Ans: B
Q.96 _________ data type can store unstructured data
(A) RAW (B) CHAR
(C) NUMERIC (D) VARCHAR
Ans: A


SHORT ANSWER TYPE QUESTIONS

Q1.  What is functional dependency?

·         Functional Dependency is a relationship that exists between multiple attributes of a relation.
·        *.  This concept is given by E. F. Codd.
·        *. Functional dependency represents a formalism on the infrastructure of relation.
·        *  It is a type of constraint existing between various attributes of a relation.
·        *  It is used to define various normal forms.
·        *  These dependencies are restrictions imposed on the data in database.
·       *  If P is a relation with A and B attributes, a functional dependency between these two attributes is represented as {A B}. It specifies that,

A
It is a determinant set.
B
It is a dependent attribute.
{A → B}
A functionally determines B.
B is a functionally dependent on A.

·         Each value of A is associated precisely with one B value. A functional dependency is trivial if B is a subset of A.
·         'A' Functionality determines 'B' {A B} (Left hand side attributes determine the values of Right hand side attributes).

Types of Functional Dependencies
·         Trivial functional dependency
·         Multivalued dependency
·         Transitive dependency

Advantages of Functional Dependency

·         Functional Dependency avoids data redundancy where same data should not be repeated at multiple locations in same database.
·         It maintains the quality of data in database.
·         It allows clearly defined meanings and constraints of databases.
·         It helps in identifying bad designs.
·         It expresses the facts about the database design.

Q2. SQL Commands

These SQL commands are mainly categorized into four categories as discussed below:
1.   DDL(Data Definition Language) : DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in database.
Examples of DDL commands:
§  CREATE – is used to create the database or its objects (like table, index, function, views, store procedure and triggers).
§  DROP – is used to delete objects from the database.
§  ALTER-is used to alter the structure of the database.
§  TRUNCATE–is used to remove all records from a table, including all spaces allocated for the records are removed.
§  COMMENT –is used to add comments to the data dictionary.
§  RENAME –is used to rename an object existing in the database.
2.   DML(Data Manipulation Language) : The SQL commands that deals with the manipulation of data present in database belong to DML or Data Manipulation Language and this includes most of the SQL statements.
Examples of DML:
§  SELECT – is used to retrieve data from the a database.
§  INSERT – is used to insert data into a table.
§  UPDATE – is used to update existing data within a table.
§  DELETE – is used to delete records from a database table.
3.   DCL(Data Control Language) : DCL includes commands such as GRANT and REVOKE which mainly deals with the rights, permissions and other controls of the database system.
Examples of DCL commands:
§  GRANT-gives user’s access privileges to database.
§  REVOKE-withdraw user’s access privileges given by using the GRANT command.
4. TCL

Q3. Transactions

           A transaction can be defined as a group of tasks. A single task is the minimum processing unit which cannot be divided further.
A transaction is a very small unit of a program and it may contain several lowlevel tasks. A transaction in a database system must maintain Atomicity, Consistency, Isolation, and Durability − commonly known as ACID properties − in order to ensure accuracy, completeness, and data integrity.
·        Atomicity − This property states that a transaction must be treated as an atomic unit, that is, either all of its operations are executed or none. There must be no state in a database where a transaction is left partially completed. States should be defined either before the execution of the transaction or after the execution/abortion/failure of the transaction.
·        Consistency − The database must remain in a consistent state after any transaction. No transaction should have any adverse effect on the data residing in the database. If the database was in a consistent state before the execution of a transaction, it must remain consistent after the execution of the transaction as well.
·        Durability − The database should be durable enough to hold all its latest updates even if the system fails or restarts. If a transaction updates a chunk of data in a database and commits, then the database will hold the modified data. If a transaction commits but the system fails before the data could be written on to the disk, then that data will be updated once the system springs back into action.
·        Isolation − In a database system where more than one transaction are being executed simultaneously and in parallel, the property of isolation states that all the transactions will be carried out and executed as if it is the only transaction in the system. No transaction will affect the existence of any other transaction.

Q4. COMMIT Command

TCL(transaction Control Language) : TCL commands deals with the transaction within the database.
Examples of TCL commands:
§  COMMIT– commits a Transaction.
§  ROLLBACK– rollbacks a transaction in case of any error occurs.
§  SAVEPOINT–sets a savepoint within a transaction.
§  SET TRANSACTION–specify characteristics for the transaction.


Q5. View

A view is nothing more than a SQL statement that is stored in the database with an associated name. A view is actually a composition of a table in the form of a predefined SQL query.
A view can contain all rows of a table or select rows from a table. A view can be created from one or many tables which depends on the written SQL query to create a view.
Database views are created using the CREATE VIEW statement. Views can be created from a single table, multiple tables or another view.
Q6. disadvantages of dbms

Disadvantages of Database Management System (DBMS):

 Although the database system yields considerable advantages over previous data management approaches, database systems do carry significant disadvantages. For example:
1. Increased costs
one of the disadvantages of dbms is Database systems require sophisticated hardware and software and highly skilled personnel. The cost of maintaining the hardware, software, and personnel required to operate and manage a database system can be substantial. Training, licensing, and regulation compliance costs are often overlooked when database systems are implemented.
2. Management complexity
Database systems interface with many different technologies and have a significant impact on a company’s resources and culture. The changes introduced by the adoption of a database system must be properly managed to ensure that they help advance the company’s objectives. Given the fact that database systems hold crucial company data that are accessed from multiple sources, security issues must be assessed constantly.
3. Maintaining currency
To maximize the efficiency of the database system, you must keep your system current. Therefore, you must perform frequent updates and apply the latest patches and security measures to all components.
Because database technology advances rapidly, personnel training costs tend to be significant. Vendor dependence. Given the heavy investment in technology and personnel training, companies might be reluctant to change database vendors.
As a consequence, vendors are less likely to offer pricing point advantages to existing customers, and those customers might be limited in their choice of database system components.
4. Frequent upgrade/replacement cycles
DBMS vendors frequently upgrade their products by adding new functionality. Such new features often come bundled in new upgrade versions of the software. Some of these versions require hardware upgrades. Not only do the upgrades themselves cost money, but it also costs money to train database users and administrators to properly use and manage the new features.

q7. SET Operations in SQL

SQL supports few Set operations which can be performed on the table data. These are used to get meaningful results from data stored in the table, under different special conditions.
In this tutorial, we will cover 4 different types of SET operations, along with example:
1.   UNION
2.   UNION ALL
3.   INTERSECT
4.   MINUS


UNION Operation

UNION is used to combine the results of two or more SELECT statements. However it will eliminate duplicate rows from its resultset. In case of union, number of columns and datatype must be same in both the tables, on which UNION operation is being applied.


Example of UNION

The First table,
ID
Name
1
abhi
2
adam
The Second table,
ID
Name
2
adam
3
Chester
Union SQL query will be,
SELECT * FROM First 
UNION
SELECT * FROM Second;
The resultset table will look like,
ID
NAME
1
abhi
2
adam
3
Chester


UNION ALL

This operation is similar to Union. But it also shows the duplicate rows.

Example of Union All

The First table,
ID
NAME
1
abhi
2
adam
The Second table,
ID
NAME
2
adam
3
Chester
Union All query will be like,
SELECT * FROM First 
UNION ALL
SELECT * FROM Second;
The resultset table will look like,
ID
NAME
1
abhi
2
adam
2
adam
3
Chester


INTERSECT

Intersect operation is used to combine two SELECT statements, but it only retuns the records which are common from both SELECT statements. In case of Intersect the number of columns and datatype must be same.
NOTE: MySQL does not support INTERSECT operator.

Example of Intersect

The First table,
ID
NAME
1
abhi
2
adam
The Second table,
ID
NAME
2
adam
3
Chester
Intersect query will be,
SELECT * FROM First 
INTERSECT
SELECT * FROM Second;
The resultset table will look like
ID
NAME
2
adam


MINUS

The Minus operation combines results of two SELECT statements and return only those in the final result, which belongs to the first set of the result.

Example of Minus

The First table,
ID
NAME
1
abhi
2
adam
The Second table,
ID
NAME
2
adam
3
Chester
Minus query will be,
SELECT * FROM First 
MINUS
SELECT * FROM Second;
The resultset table will look like,
ID
NAME
1
abhi

Q7. What is decomposition?
  • Decomposition is the process of breaking down in parts or elements.
  • It replaces a relation with a collection of smaller relations.
  • It breaks the table into multiple tables in a database.
  • It should always be lossless, because it confirms that the information in the original relation can be accurately reconstructed based on the decomposed relations.
  • If there is no proper decomposition of the relation, then it may lead to problems like loss of information.
Properties of Decomposition
Following are the properties of Decomposition,
1. Lossless Decomposition
2. Dependency Preservation
3. Lack of Data Redundancy
Q8. Dependency Preservation
  • Dependency is an important constraint on the database.
  • Every dependency must be satisfied by at least one decomposed table.
  • If {A B} holds, then two sets are functional dependent. And, it becomes more useful for checking the dependency easily if both sets in a same relation.
  • This decomposition property can only be done by maintaining the functional dependency.
  • In this property, it allows to check the updates without computing the natural join of the database structure.
Q10. Features of Normalization
·         Normalization avoids the data redundancy.
·         It is a formal process of developing data structures.
·         It promotes the data integrity.
·         It ensures data dependencies make sense that means data is logically stored.
·         It eliminates the undesirable characteristics like Insertion, Updation and Deletion Anomalies.

Q11. Advantages of SQL

·         SQL provides a greater degree of abstraction than procedural language.
·         It is coded without embedded data-navigational instructions.
·         It enables the end users to deal with a number of database management systems where it is available.
·         It retrieves quickly and efficiently huge amount of records from a database.
·         No coding required while using standard SQL.

Q12. What is constraints?

·         A set of rules are defined to enforce the database integrity, is called as Constraints.
·         The main purpose of constraint is to permit or prohibit the values in the columns.

Following are the Types of Constraint,
1. Primary Key
2. Foreign Key
3. Unique Key
4. Check Constraint
5. Not Null



No comments:

Post a Comment