Oral Questions Dbms Lab
Oral Questions Dbms Lab
1. What is MySQL?
Why MySQL is used? MySQL database server is reliable, fast and very easy to use. This software
can be downloaded as freeware and can be downloaded from the internet.
A foreign key is one table which can be related to the primary key of another table. Relationship
needs to be created between two tables by referencing foreign key with the primary key of another
table.
7. What is a View?
A view is a virtual table which consists of a subset of data contained in a table. Views are not
virtually present, and it takes less space to store. View can have data of one or more tables
combined, and it is depending on the relationship.
8. What is an Index?
An index is performance tuning method of allowing faster retrieval of records from the table. An
index creates an entry for each value and it will be faster to retrieve data.
This type of index reorders the physical order of the table and search based on the key values. Each
table can have only one clustered index.
NonClustered Index.
NonClustered Index does not alter the physical order of the table and maintains logical order of
data. Each table can have 999 nonclustered indexes.
11. What happens when the column is set to AUTO INCREMENT and if you reach maximum
value in the table? It stops incrementing. Any further inserts are going to produce an error, since the
key has been used already
12. How can you see all indexes defined for a table? Indexes are defined for the table by:
SHOW INDEX FROM tablename
13. What do you mean by % and _ in the LIKE statement? % corresponds to 0 or more
characters, _ is exactly one character in the LIKE statement
17.What is subquery?
A subquery is a query within another query. The outer query is called as main query, and inner
query is called subquery. SubQuery is always executed first, and the result of subquery is passed on
to the main query.
21. Explain the purpose of %TYPE and %ROWTYPE data types with the example?
Answer: PL/SQL uses %TYPE declaration attribute for anchoring. This attribute provides the datatype
of a variable, constant or column. %TYPE attribute is useful while declaring a variable that has the same
datatype as a table column.
For example, the variable m_empno has the same data type and size as the column empno in table emp.
m_empno emp.empno%TYPE;
%ROWTYPE attribute is used to declare a variable to be a record having the same structure as a row in
a table. The row is defined as a record and its fields have the same names and data types as the columns
in the table or view.
For example: dept_rec dept%ROWTYPE;
This declares a record that can store an entire row for DEPT table.
Answer: A stored procedure is executed explicitly by issuing procedure call statement from another
block via a procedure call with arguments.
The trigger is executed implicitly whenever any triggering event like the occurrence of DML statements
happens.
Mongo-DB is a document database which provides high performance, high availability and easy
scalability.
28) What is “Namespace” in MongoDB?
MongoDB stores BSON (Binary Interchange and Structure Object Notation) objects in the
collection. The concatenation of the collection name and database name is called a namespace.
29 What is sharding in MongoDB?
The procedure of storing data records across multiple machines is referred as Sharding. It is a
MongoDB approach to meet the demands of data growth. It is the horizontal partition of data in a
database or search engine. Each partition is referred as shard or database shard.
30. What is the syntax to create a collection and to drop a collection in MongoDB?
34.Define cursor.
A database object which helps in manipulating data row by row representing a result set is called
cursor.
35. Enlist the types of cursor.
They types of cursor are: Implicit cursor: Declared automatically as soon as the execution of SQL
takes place without the awareness of the user. Explicit cursor: Defined by PL/ SQL which
handles query in more than one row.
36. Define sub-query.
A query contained by a query is called Sub-query.
37. Why is group-clause used?
Group-clause uses aggregate values to be derived by collecting similar data.
38.Define Aggregate functions.
Functions which operate against a collection of values and returning single value is called aggregate
functions.
39. What is JSON? Explain?
Ans: JSON is the abbreviation of JavaScript Object Notation. It is one of the simplest data interchange
format. It is also independent of programming language and platform. Its lightweight text-based
structure makes it easily readable by a human. It is derived from JavaScript for presenting simple data in
the form of key-value pairs.
It is often used for serialization and transmission of data between the network connections. It is mostly
used for data transmission between a web application and the server thereby making it a popular
alternative to the XML format.
Ans: There are several rules that describe the structure of the JSON. They are:
Data inside a JSON is arranged in Key value pair. The left side represents the key and the data at the
right side represents value. Both key and value are separated by a colon “:”.
Each set of key-value pair is separated from the other pair by using a comma “,”.
Curly braces define the JSON objects. Left curly brace “{“ represents the start of the object and right
curly brace “}” represents the end of an object.
Arrays are defined inside a JSON object by using square brackets “[ ]”.
42. What are the advantages of JSON over XML?
Ans: JSON has emerged as one of the most popular data interchange methods. It has several advantages
over the XML that has to help it to replace XML as a most popular data transfer format.
JSON is lighter and faster than the XML.
JSON has object types but XML doesn’t define objects as types. JSON have different object type for a
different set of data such as string, integer, Boolean, array etc. All XML objects are categorized as just
one data type, i.e. string.
JSON data can be easily accessed as a JSON object using JavaScript. On the other hand, the XML data
need to be parsed and allocated to the variables using APIs. Getting a value out of a JSON is as easy as
reading an object from your JavaScript programming.