Académique Documents
Professionnel Documents
Culture Documents
1. What is database?
2. What is DBMS?
4. Advantages of DBMS?
Ø Redundancy is controlled.
Locking granularity refers to the size and hence the number of locks
used to ensure the consistency of a database during multiple
concurrent updates.
Entity Integrity: States that “Primary key cannot have NULL value”
This data model is based on real world that consists of basic objects
called entities and of relationship among these objects. Entities are
described in a database by a set of attributes.
An entity set may not have sufficient attributes to form a primary key,
and its primary key compromises of its partial key and primary key of
its parent entity, then it is said to be Weak Entity set.
Ø Physical level: The lowest level of abstraction describes how data are
stored.
Ø Minimizing redundancy
The domain
Ø X is a Super-key of R.
Ø A is a prime attribute of R.
The most important objective to write the log before the database is
changed is if there is any need to rollback or rollforward any
transaction then if the log are not present then the rollback rollforward
cannot be done accurately.
44. what is the difference between DBMS and RDBMS??
iii) In DBMS there is no concept of PRIMARY KEY and FOREIGN KEY but
it is included in RDBMS.
iv) DBMS contains only flat data whereas in RDBMS there will be some
relation between the entities.
the server check all the data in the EMP file and it displays the data of
the EMP file
Answer: When this clause is used with the DROP command, a parent
table can be dropped even when a child table exists.
SQL Server/Sybase :
Employee_table.Dept_id(+) = Dept_table.Dept_id
Answer: Variable names should start with an alphabet. Here the table
name starts with an '&' symbol.
Answer: Varchar means fixed length character data (size) i.e., min
size-1 and max-2000
Answer: You set the LIST or L command to get the recent one from
SQL Buffer
Answer: USER_CONSTRAINTS.
55.How do I write a program which will run a SQL query and
mail the results to a group?
While inserting the data into the table M was misspelled as F and F as
M.
Answer: union will return the distinct rows in two select s, while union
all return all rows.
Answer: You can backup the sql files through backup utilities or some
backup command in sql. SAP is ERP software for the organization to
integrate the software.
WHERE clause can be used with DELETE and not with TRUNCATE.
Answer: True.
62.State true or false. EXISTS, SOME, ANY are operators in
SQL.
Answer: True.
Answer: TROUBLETHETROUBLE.
SELECT Academic_Status
FROM tbl_enr_status
GROUP BY Academic_Status
PIVOT Curnt_status;
Answer: To retrieve data with SQL one row at a time you need to use
cursor processing. Not all relational databases support this, but many
do. Here I show this in Oracle with PL/SQL, which is Procedural
Language SQL .Cursor processing is done in several steps:1. Define the
rows you want to retrieve. This is called declaring the cursor.2. Open
the cursor. This activates the cursor and loads the data. Note that
declaring the cursor doesn't load data, opening the cursor does.3.
Fetch the data into variables.4. Close the cursor.
First Normal Form: Every field of a table (row, col) must contain an
atomic value
Each normal form assumes that the table is already in the earlier
normal form.
Answer: The query will be: delete from tabname where rowid not in
(select max (rowid) from tabname group by name) Here tabname is
the table name.
Answer: select max (field1) from tname1 where field1= (select max
(field1) from tname1 where field1<(select max(field1) from tname1);
Answer: The privilege receiver can further grant the privileges he/she
has obtained from the owner to any other user.
IN -- The inner query is executed first and the list of values obtained as
its result is used by the outer query. The inner query is executed for
only once.
EXISTS -- The first row from the outer query is selected, then the inner
query is executed and, the outer query output uses this result for
checking. This process of inner query execution repeats as many no .of
times as there are outer query rows. That is, if there are ten rows that
can result from outer query, the inner query is executed that many no.
of times.
76. How to find out the 10th highest salary in SQL query?
Column - int_salary
from Tbl_Test_Salary
where int_salary in
Answer: SQL Server is an RDBMS just like oracle, DB2 from Microsoft
whereas
It gives the added value of sal and comm for each employee in the
emp table.
Answer: select max (field1) from tname1 where field1= (select max
(field1) from tname1 where field1< (select max (field1) from tname1);
WHERE COL1 IN
GROUP BY COL1
group by (empid)
Union will remove the duplicate rows from the result set while
Union all does'nt.
Both will result in deleting all the rows in the table .TRUNCATE call
cannot be rolled back as it is a DDL command and all memory space
for that table is released back to the server. TRUNCATE is much
faster.Whereas DELETE call is an DML command and can be rolled
back.
yes,
USER_CONSTRAINTS,
92.Explain normalization ?
first normal forms, second normal forms, third normal forms and fourth
Normal forms.
whereas
Nested subquery runs only once for the entire nesting (outer)
query. It does not contain any reference to the outer query row.
For example,
Correlated Subquery:
Nested Subquery:
Pattern matching operator is LIKE and it has to used with two attributes
1. % and
2. _ ( underscore )
% means matches zero or more characters and under score means
mathing exactly one character
Advantages
Disadvantage
1) There can be more than one keys on which all the other attributes
are dependent on.
Foreign Key
Advantage
1)It allows refrencing another table using the primary key for the other
table
Datediff
for Eg: select datediff (dd,'2-06-2007','7-06-2007')
output is 5