SlideShare a Scribd company logo
Database
Database Question Answers
1
Simple SQL queries for fetching data from
a table
Select <column_name> from <tablename> where column_name=XXX; Select ename,salary,jobdesc
from employee where empid=2222;
2
Table) and we need to do join on these
tables to get selected data.
Select d.department_name,d.location_id,e.last_name ,e.salary from employee e,department d where
e.department_id=d.department_id and d.location_id=2000;
3
Difference between Unique Key and
Primary Key
Primary key cannot accept null values
Unique key can accept null values
Table can have only one primary key and it can have any number of unique key.
4 Basic question on Index used in DB.
Index are basically used to improve performance of Query
An Index can be created on a single column or a combination of columns in a database table. A table
index is a database structure that arranges the values of one or more columns in a database table in
specific order. The table index has pointers to the values stored in specified column or combination of
columns of the table. These pointers are ordered depending on the sort order specified in the index
5 Foreign Key constraint.
A FOREIGN KEY in one table points to a PRIMARY KEY in another table
The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables
The FOREIGN KEY constraint also prevents that invalid data form being inserted into the foreign key
column, because it has to be one of the values contained in the table it points to.
6
Marks of individual Student from the
following table Select stud_name,avg(marks) from student where class=10 group by stud_name;
7
What are the main points which we need to
keep in mind while doing DB testing.
1>Error handling should be available with proper messages.
2>DB test case coverage should be proper etc etc
8 Work of Order by, group by command
ORDER BY clause is used to order the data sets retrieved from a SQL database. The ordering
of the selected data can be done by one or more columns in a table. If we want to sort our
Users table by the FirstName column, we’ll have to use the following ORDER BY SQL statement
select * from employee order by first_name;
Group By: -It is used to group the retreive data by one or more table . example select empname
from employee group by employee name;
9 What is Normalization?
Normalization is the process of efficiently organizing data in a database. Two goals of normalizations
are
1>Eliminating redundent data (storing data in more then one table.)
2>Ensuring Data dependencies(only storing related data in a table)
10 business applications?
11 What is a truncate statement?
Truncate is a DDL Command.It remove all rows from the table. It basically release all the storage space
used by that table. It is Faster then delete. You cannot rollback truncate command
12 into a table. Insert into employee values (employee_name,employee_id,employee_code) ('Manish',61612,'BSC');
13 employee who's age is maximum. Select Employee_name from Employee where Eage = (Select max(Eage) from Emplyee);
14
Do you know about Joins(Types of Joins
with example)
the unmatched rows from the first (left) table, joining them with a NULL row in the shape of the second
(right) table.A RIGHT OUTER JOIN is one of the JOIN operations that allow you to specify a JOIN
clause. It preserves the unmatched rows from the second (right) table, joining them with a NULL in the
shape of the first (left) table. Self join is used to join a table to itself
15
Difference between having and where
clauses.
It can be used without the GROUP BY clause. The HAVING clause cannot be used without the GROUP
BY clause. The WHERE clause selects rows before grouping. The HAVING clause selects rows after
grouping. The WHERE clause cannot contain aggregate functions. The HAVING clause can contain
aggregate functions.
16 Describe constraints in SQL.
NOT NULL Constraint: Ensures that a column cannot have NULL value.
DEFAULT Constraint: Provides a default value for a column when none is specified.
UNIQUE Constraint: Ensures that all values in a column are different.
CHECK Constraint: Makes sure that all values in a column satisfy certain criteria.
Primary Key Constraint: Used to uniquely identify a row in the table.
Foreign Key Constraint: Used to ensure referential integrity of the data
17
empid & emp name details and salary
table has empid,month and sal
details.Write a query to find Pradeep's
18
Difference between unique key and
primary key?
Unique key can be more than one for a table but there could be only one primary key. Unique key can
take NULL but primary key cannot
19 How much you will rate out of 10 in SQL?
Page 1
Database
20 Update command
UPDATE "table_name"
SET "column_1" = [new value]
WHERE {condition}
21 What is index?
Indexes help us retrieve data from tables quicker.Without an index, the database system reads through
the entire table (this process is called a 'table scan') to locate the desired information. With the proper
index in place, the database system can then first go through the index to find out where to retrieve the
data, and then go to these locations directly to get the needed data. This is much faster.
22
How do you find the second max salary of
an employee
SELECT MIN(Sal) FROM TableName
WHERE Sal IN
(SELECT TOP 2 Sal FROM TableName ORDER BY Sal DESC)
23
What is the difference from truncate,drop
and delete commands
remove some rows. If no WHERE condition is specified, all rows will be removed. After performing a
DELETE operation you need to COMMIT or ROLLBACK the transaction to make the change
permanent or to undo it.TRUNCATE removes all rows from a table. The operation cannot be rolled
back and no triggers will be fired.The DROP command removes a table from the database.All the
tables' rows, indexes and privileges will also be removed. No DML triggers will be fired. The operation
cannot be rolled back. DROP and TRUNCATE are DDL commands, whereas DELETE is a DML
command.Therefore DELETE operations can be rolled back (undone), while DROP and TRUNCATE
24 What is Data feeds?
25 server 2003 and 2008
26 Syntax to insert data in table. Insert into table (columns names) values(column values).
27 How you will count records in table. Select count(*) from table.
28 How you will increase table performance.
We will use indexes.
29 What is STLC?
STLC by & large comprises of following Six Sequential Phases:
1) Planning of Tests
2) Analysis of Tests
3) Designing of Tests
4) Creation & Verification of Tests
5) Execution of Testing Cycles
6) Performance Testing, Documentation
7) Actions after Implementation
30 Difference between TABLE and VIEW.
31
What is difference between Drop, Delete,
Truncate?
Difference between DELETE and TRUNCATE Statements:
DELETE Statement: This command deletes only the rows from the table based on the condition given
in the where clause or deletes all the rows from the table if no condition is specified. But it does not free
the space containing the table.
TRUNCATE statement: This command is used to delete all the rows from the table and free the space
containing the table.
SQL DROP Statement:
The SQL DROP command is used to remove an object from the database. If you drop a table, all the
rows in the table is deleted and the table structure is removed from the database. Once a table is
dropped we cannot get it back, so be careful while using RENAME command. When a table is dropped
all the references to the table will not be valid. Difference
between DROP and TRUNCATE Statement:
32
What is the purpose of joins other than
retrieving data from different tables?
Join can be used to update, delete or insert data in tables
33
What is the difference between truncate
and delete?
1. Truncate is a DDL statement where as delete is DML
2. Truncate cannot be rolled back
3. Truncate is w/o where clause
34
What is referential integrity? A feature provided by relational database management systems (RDBMS's) that prevents users or
applications from entering inconsistent data. Most RDBMS's have various referential integrity rules that
you can apply when you create a relationship between two tables.
For example, suppose Table B has a foreign key that points to a field in Table A. Referential integrity
would prevent you from adding a record to Table B that cannot be linked to Table A. In addition, the
referential integrity rules might also specify that whenever you delete a record from Table A, any
records in Table B that are linked to the deleted record will also be deleted. This is called cascading
delete. Finally, the referential integrity rules could specify that whenever you modify the value of a
linked field in Table A, all records in Table B that are linked to it will also be modified accordingly. This
is called cascading update.
35
An application has a field that accepts
numbers between 0 and 100. How many
test cases will you create and what
approach will you use?
test cases required are:
For values < 0
for values between 0 and 100
for values > 100
Page 2
Database
36
What are the various modules in QC?
What are the various tabs in QC?
Difference between Test Plan and Test
Lab.
Tabs in Quality centre :
Requirements , test resource , test plan , test lad and defects
Difference in test plan and test lab:
In test lab we create the folder structure and write the test cases corresponding to a system
in test lab we select the test cases written in test plan and execute them as Pass/Fail/NA
37 What is the syntax of grep command? grep pattern string
38 directory?
39 file?
40
What is foreign key? Explain with the help
of an example. Why do we require a
foreign key?
A feature provided by relational database management systems (RDBMS's) that prevents users or
applications from entering inconsistent data. Most RDBMS's have various referential integrity rules that
you can apply when you create a relationship between two tables.
For example, suppose Table B has a foreign key that points to a field in Table A. Referential integrity
would prevent you from adding a record to Table B that cannot be linked to Table A. In addition, the
referential integrity rules might also specify that whenever you delete a record from Table A, any
records in Table B that are linked to the deleted record will also be deleted. This is called cascading
delete. Finally, the referential integrity rules could specify that whenever you modify the value of a
linked field in Table A, all records in Table B that are linked to it will also be modified accordingly. This
is called cascading update.
41 Can a join have WHERE clause in it? yes
42
What is the difference in the resulting set
for the following two syntax of JOINs:
SELECT * FROM table1, table2 where
table1.col=table2.col
SELECT * FROM table1 JOIN table2 ON
table1.col=table2.col
no difference in both… they will yield the same result
43
EmpName , Department).
Write query for finding out how many
employees are there in each department. select count(emp_id) from employee group by department
44
Query to delete a row from parent table tha
has corresponding rows in child table.
Delete from tableA
Where exists (
Select 1 from tableB
where tableA.key=tableB.key
and tableB.last_update_dtm=sysdate-30)
45
Basic of Quality Centre. What all tabs are
there?
Tabs in Quality centre :
Requirements , test resource , test plan , test lad and defects
46
can i delete a row from one table which
has a refrential integrity on another table yes… using delete cascade option.
47
What are joins? Difference between Left
Outer Join and Right Outer Join.
The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a
relationship between certain columns in these tables.
The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no
matches in the right table (table_name2).
The RIGHT JOIN keyword returns all the rows from the right table (table_name2), even if there are no
matches in the left table (table_name1).
48 what is a view ? where do we use the joins
A view contains rows and columns, just like a real table. The fields in a view are fields from one or more
real tables in the database.
You can add SQL functions, WHERE, and JOIN statements to a view and present the data as if the
data were coming from one single table.
SQL CREATE VIEW Syntax
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
49 syntax of update, insert statements.
update tablename set columnname=value <where condition>
insert into table tablename values (values 1 , value 2 …………….)
50
employee from Staff table. Consider Age is
captured as it is in the database table select min(age) , emp_name from staff where emp_id in ( select top 2 age from staff order by age desc)
Page 3
Database
51 Aggregate functions
SQL aggregate functions return a single value, calculated from values in a column.
Useful aggregate functions:
AVG() - Returns the average value
COUNT() - Returns the number of rows
FIRST() - Returns the first value
LAST() - Returns the last value
MAX() - Returns the largest value
MIN() - Returns the smallest value
SUM() - Returns the sum
52 Difference between count and count(*)
in count(*) , null values are counted
in count(column name) , null values are not counted
53 Rollback/Commit
COMMIT Statement -- commit (make persistent) all changes for the current transaction
ROLLBACK Statement -- roll back (rescind) all changes for the current transaction
54
There's a table having 15 coumns and we
need to create sample data for it. How will
you insert thousands of data in this table.
insert into table <tablename> values ('value 1' , 'value 2', 'value3')
('value 11' , 'value1 2', 'value13')…..
55 Difference between Where and Having.
Where is used for placing any condition
Having is used for placing condition on coloumns using aggregate function in select statement
where can be used with or without group by
having cannot be used without group by
56 query. select * from employees group by department order by name.
57 DDL/DML/DCL commands.
DDL
Data Definition Language (DDL) statements are used to define the database structure or schema.
Some examples:
CREATE - to create objects in the database
ALTER - alters the structure of the database
DROP - delete objects from the database
TRUNCATE - remove all records from a table, including all spaces allocated for the records are
removed
COMMENT - add comments to the data dictionary
RENAME - rename an object
DML
Data Manipulation Language (DML) statements are used for managing data within schema objects.
Some examples:
SELECT - retrieve data from the a database
INSERT - insert data into a table
UPDATE - updates existing data within a table
DELETE - deletes all records from a table, the space for the records remain
MERGE - UPSERT operation (insert or update)
CALL - call a PL/SQL or Java subprogram
EXPLAIN PLAN - explain access path to data
LOCK TABLE - control concurrency
DCL
Data Control Language (DCL) statements. Some examples:
GRANT - gives user's access privileges to database
58 Why is Alter a DDL and not DML? Because Alter command alters the structure (definition) of table and not the data of the table
59 What is Normalization?
usually involves dividing a database into two or more tables and defining relationships between the
tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be
made in just one table and then propagated through the rest of the database via the defined
relationships.
60 Different forms of normalization.
g
First Normal Form (1NF): Each field in a table contains different information. For example, in an
employee list, each table would contain only one birthdate field.
Second Normal Form (2NF): Each field in a table that is not a determiner of the contents of another field
must itself be a function of the other fields in the table.
Third Normal Form (3NF): No duplicate information is permitted. So, for example, if two tables both
require a birthdate field, the birthdate information would be separated into a separate table, and the two
other tables would then access the birthdate information via an index field in the birthdate table. Any
change to a birthdate would automatically be reflect in all tables that link to the birthdate table.
There are additional normalization levels, such as Boyce Codd Normal Form (BCNF), fourth normal
form (4NF) and fifth normal form (5NF). While normalization makes databases more efficient to
maintain, they can also make them more complex because data is separated into so many different
tables.
(2) In data processing, a process applied to all data in a set that produces a specific statistical property.
For example, each expenditure for a month can be divided by the total of all expenditures to produce a
61 Difference between Primary key and Unique
Primary key doesnot allow null value but unique key allows
null value. We can declare only one primary key in a table
but a table can have multiple unique key(column assign).
Page 4
Database
62 employee table?
63 What are Indexes and types of Indexs
SQL Index
Index in sql is created on existing tables to retrieve the rows quickly.
When there are thousands of records in a table, retrieving information will take a long time. Therefore
indexes are created on columns which are accessed frequently, so that the information can be retrieved
quickly. Indexes can be created on a single column or a group of columns. When a index is created, it
first sorts the data and then it assigns a ROWID for each row.
Syntax to create Index:
CREATE INDEX index_name
ON table_name (column_name1,column_name2...);
Syntax to create SQL unique Index:
CREATE UNIQUE INDEX index_name
ON table_name (column_name1,column_name2...);
index_name is the name of the INDEX.
table_name is the name of the table to which the indexed column belongs.
column_name1, column_name2.. is the list of columns which make up the INDEX.
In Oracle there are two types of SQL index namely, implicit and explicit.
Implicit Indexes:
They are created when a column is explicity defined with PRIMARY KEY, UNIQUE KEY Constraint.
Explicit Indexes:
They are created using the "create index.. " syntax.
NOTE:
1) Even though sql indexes are created to access the rows in the table quickly, they slow down DML
operations like INSERT, UPDATE, DELETE on the table, because the indexes and tables both are
updated along when a DML operation is performed. So use indexes only on columns which are used to
64
For database performance which is better
sub-query or Join and why?
Most of the Cases JOINS are faster then Sub-queries and it is very rare conditions sub-query become
faster. In joins RDBMS can create an execution plan that suits better for your query and can predict
what data should be loaded to be processed and save time unlike the sub-query where it should run all
the queries and load all their data to do the processing
The good thing in sub-queries that they are more readable then joins, that's why most of new SQL
people prefer them because it is the easy way. but when it comes for performance JOINS are better in
most cases even though they are not hard to read too.
65
records and table 'B' have 1000 records,
which table will you get scan first for better
depends upon the index.
Depends on which column index is made and how often it is used while retrieving the data
66 How to create a table
The CREATE TABLE statement allows you to create and define a table.
The basic syntax for a CREATE TABLE statement is:
CREATE TABLE table_name
( column1 datatype null/not null,
column2 datatype null/not null,
...
);
Each column must have a datatype. The column should either be defined as "null" or "not null" and if
this value is left blank, the database assumes "null" as the default.
67
What is normalization and
denormalization?
tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be
made in just one table and then propagated through the rest of the database via the defined
relationships.
Denormalization is a technique to move from higher to lower normal forms of database modeling in
order to speed up database access. You may apply Denormalization in the process of deriving a
physical data model from a logical form.
68 ETL and schedulers?
69 Cubes?
70
Sort in order Where,Group By,Having and
Order by
where
group by
having
order by
Page 5
Database
71
What Is the diff between row id and Row
num
y q y y , q y
where a row resides on disk. The information in a ROWID gives Oracle everything he needs to find
your row, the disk number, the cylinder, block and offset into the block.
The ROWNUM is a "pseudo-column", a placeholder that you can reference in SQL*Plus. The
ROWNUM can be used to write specialized SQL and tune SQL.
For example, to only display the first-10 rows, you might apply a ROWNUM filter:
select *
from (
select * from my_view where alert_level=3 order by alert_time desc)
where
rownum<=10;
In sum, the difference between ROWNUM and ROWID is that ROWNUM is temporary while ROWID
is permanent. Another difference is that ROWID can be used to fetch a row, while ROWID only has
meaning within the context of a single SQL statement, a way of referencing rows within a fetched result
set
72 find the 50th record
73
main table and B is audit table. If I want
that whatever changes I make in table A
should be updated as an entry in B as log ,
using trggers
Use after trigger --- > apply on insertion of values in table A
74
How would we transfer data from one table
to another without creating the first one.
CREATE TABLE new_table
AS (SELECT * FROM old_table WHERE 1=2);
75
before staging Db eg Empd id is changed
from 10 to 20 char. Now what all things
would we test:
76 Write query to find duplicate records select * from employee where emp_id not in ( Select distinct emp_id from employee);
77 DB or denormalised Db Normalised DB
78
A depend on B
B depend on C
C depend on D
which way you will create the table and
after creating in which way you will delete
the table?
creation = D C B A
Deletion can be in any order using delete cascade option.
79
What is Indexing? Indexes help us retrieve data from tables quicker.Without an index, the database system reads through
the entire table (this process is called a 'table scan') to locate the desired information. With the proper
index in place, the database system can then first go through the index to find out where to retrieve the
data, and then go to these locations directly to get the needed data. This is much faster.
80 a table ?
81
what join type would you use to find
out in and out time of employee which
82
How to get the no. of records from a table
apart from count (*) function
83
retrieving the records from select *
statement, it is showing only 80 records
1. There may be a duplicate records and to retrieve the data distinct clause is used
2. The table may be referencing some other table and through join the record has being fetched
84 table? using group by and having clause
85 using row id? delete from table where column name Not In(select distinct column name from table)
86 Give an example of self join with query?
87
1
st
table(employee):
employeeID,Name, Salary,
Department ID
2
nd
table:(Department): Deprt.ID,
EmpId, Empdesc
3
rd
table:(Salary) Emp ID and Salary
88 What we test in database testing?
89 What is candidate key?
90
Page 6

More Related Content

Similar to Interview Questions.pdf

SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
PavithSingh
 
Adbms
AdbmsAdbms
Adbms
jass12345
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
DraguClaudiu
 
SQL Query
SQL QuerySQL Query
SQL Query
Imam340267
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
Sheethal Aji Mani
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
paddu123
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
paddu123
 
Its about a sql topic for basic structured query language
Its about a sql topic for basic structured query languageIts about a sql topic for basic structured query language
Its about a sql topic for basic structured query language
IMsKanchanaI
 
Sql DML
Sql DMLSql DML
Sql DML
Vikas Gupta
 
Sql DML
Sql DMLSql DML
Sql DML
Vikas Gupta
 
Data base management system comprehensive module 2 ppt
Data base management system comprehensive module 2 pptData base management system comprehensive module 2 ppt
Data base management system comprehensive module 2 ppt
SwathiSoman5
 
Database Overview
Database OverviewDatabase Overview
Database Overview
Livares Technologies Pvt Ltd
 
Dbms question
Dbms questionDbms question
Dbms question
Ricky Dky
 
Assg2 b 19121033-converted
Assg2 b 19121033-convertedAssg2 b 19121033-converted
Assg2 b 19121033-converted
SUSHANTPHALKE2
 
2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used
TheVerse1
 
Advanced Sql Training
Advanced Sql TrainingAdvanced Sql Training
Advanced Sql Training
bixxman
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 
Oracle SQL Part 2
Oracle SQL Part 2Oracle SQL Part 2
Oracle SQL Part 2
Gurpreet singh
 

Similar to Interview Questions.pdf (20)

SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
 
Adbms
AdbmsAdbms
Adbms
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
 
SQL Query
SQL QuerySQL Query
SQL Query
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Its about a sql topic for basic structured query language
Its about a sql topic for basic structured query languageIts about a sql topic for basic structured query language
Its about a sql topic for basic structured query language
 
Mysql
MysqlMysql
Mysql
 
Sql DML
Sql DMLSql DML
Sql DML
 
Sql DML
Sql DMLSql DML
Sql DML
 
Data base management system comprehensive module 2 ppt
Data base management system comprehensive module 2 pptData base management system comprehensive module 2 ppt
Data base management system comprehensive module 2 ppt
 
Database Overview
Database OverviewDatabase Overview
Database Overview
 
Dbms question
Dbms questionDbms question
Dbms question
 
Assg2 b 19121033-converted
Assg2 b 19121033-convertedAssg2 b 19121033-converted
Assg2 b 19121033-converted
 
2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used
 
Advanced Sql Training
Advanced Sql TrainingAdvanced Sql Training
Advanced Sql Training
 
Sql commands
Sql commandsSql commands
Sql commands
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
Oracle SQL Part 2
Oracle SQL Part 2Oracle SQL Part 2
Oracle SQL Part 2
 

Recently uploaded

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 

Recently uploaded (20)

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 

Interview Questions.pdf

  • 1. Database Database Question Answers 1 Simple SQL queries for fetching data from a table Select <column_name> from <tablename> where column_name=XXX; Select ename,salary,jobdesc from employee where empid=2222; 2 Table) and we need to do join on these tables to get selected data. Select d.department_name,d.location_id,e.last_name ,e.salary from employee e,department d where e.department_id=d.department_id and d.location_id=2000; 3 Difference between Unique Key and Primary Key Primary key cannot accept null values Unique key can accept null values Table can have only one primary key and it can have any number of unique key. 4 Basic question on Index used in DB. Index are basically used to improve performance of Query An Index can be created on a single column or a combination of columns in a database table. A table index is a database structure that arranges the values of one or more columns in a database table in specific order. The table index has pointers to the values stored in specified column or combination of columns of the table. These pointers are ordered depending on the sort order specified in the index 5 Foreign Key constraint. A FOREIGN KEY in one table points to a PRIMARY KEY in another table The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables The FOREIGN KEY constraint also prevents that invalid data form being inserted into the foreign key column, because it has to be one of the values contained in the table it points to. 6 Marks of individual Student from the following table Select stud_name,avg(marks) from student where class=10 group by stud_name; 7 What are the main points which we need to keep in mind while doing DB testing. 1>Error handling should be available with proper messages. 2>DB test case coverage should be proper etc etc 8 Work of Order by, group by command ORDER BY clause is used to order the data sets retrieved from a SQL database. The ordering of the selected data can be done by one or more columns in a table. If we want to sort our Users table by the FirstName column, we’ll have to use the following ORDER BY SQL statement select * from employee order by first_name; Group By: -It is used to group the retreive data by one or more table . example select empname from employee group by employee name; 9 What is Normalization? Normalization is the process of efficiently organizing data in a database. Two goals of normalizations are 1>Eliminating redundent data (storing data in more then one table.) 2>Ensuring Data dependencies(only storing related data in a table) 10 business applications? 11 What is a truncate statement? Truncate is a DDL Command.It remove all rows from the table. It basically release all the storage space used by that table. It is Faster then delete. You cannot rollback truncate command 12 into a table. Insert into employee values (employee_name,employee_id,employee_code) ('Manish',61612,'BSC'); 13 employee who's age is maximum. Select Employee_name from Employee where Eage = (Select max(Eage) from Emplyee); 14 Do you know about Joins(Types of Joins with example) the unmatched rows from the first (left) table, joining them with a NULL row in the shape of the second (right) table.A RIGHT OUTER JOIN is one of the JOIN operations that allow you to specify a JOIN clause. It preserves the unmatched rows from the second (right) table, joining them with a NULL in the shape of the first (left) table. Self join is used to join a table to itself 15 Difference between having and where clauses. It can be used without the GROUP BY clause. The HAVING clause cannot be used without the GROUP BY clause. The WHERE clause selects rows before grouping. The HAVING clause selects rows after grouping. The WHERE clause cannot contain aggregate functions. The HAVING clause can contain aggregate functions. 16 Describe constraints in SQL. NOT NULL Constraint: Ensures that a column cannot have NULL value. DEFAULT Constraint: Provides a default value for a column when none is specified. UNIQUE Constraint: Ensures that all values in a column are different. CHECK Constraint: Makes sure that all values in a column satisfy certain criteria. Primary Key Constraint: Used to uniquely identify a row in the table. Foreign Key Constraint: Used to ensure referential integrity of the data 17 empid & emp name details and salary table has empid,month and sal details.Write a query to find Pradeep's 18 Difference between unique key and primary key? Unique key can be more than one for a table but there could be only one primary key. Unique key can take NULL but primary key cannot 19 How much you will rate out of 10 in SQL? Page 1
  • 2. Database 20 Update command UPDATE "table_name" SET "column_1" = [new value] WHERE {condition} 21 What is index? Indexes help us retrieve data from tables quicker.Without an index, the database system reads through the entire table (this process is called a 'table scan') to locate the desired information. With the proper index in place, the database system can then first go through the index to find out where to retrieve the data, and then go to these locations directly to get the needed data. This is much faster. 22 How do you find the second max salary of an employee SELECT MIN(Sal) FROM TableName WHERE Sal IN (SELECT TOP 2 Sal FROM TableName ORDER BY Sal DESC) 23 What is the difference from truncate,drop and delete commands remove some rows. If no WHERE condition is specified, all rows will be removed. After performing a DELETE operation you need to COMMIT or ROLLBACK the transaction to make the change permanent or to undo it.TRUNCATE removes all rows from a table. The operation cannot be rolled back and no triggers will be fired.The DROP command removes a table from the database.All the tables' rows, indexes and privileges will also be removed. No DML triggers will be fired. The operation cannot be rolled back. DROP and TRUNCATE are DDL commands, whereas DELETE is a DML command.Therefore DELETE operations can be rolled back (undone), while DROP and TRUNCATE 24 What is Data feeds? 25 server 2003 and 2008 26 Syntax to insert data in table. Insert into table (columns names) values(column values). 27 How you will count records in table. Select count(*) from table. 28 How you will increase table performance. We will use indexes. 29 What is STLC? STLC by & large comprises of following Six Sequential Phases: 1) Planning of Tests 2) Analysis of Tests 3) Designing of Tests 4) Creation & Verification of Tests 5) Execution of Testing Cycles 6) Performance Testing, Documentation 7) Actions after Implementation 30 Difference between TABLE and VIEW. 31 What is difference between Drop, Delete, Truncate? Difference between DELETE and TRUNCATE Statements: DELETE Statement: This command deletes only the rows from the table based on the condition given in the where clause or deletes all the rows from the table if no condition is specified. But it does not free the space containing the table. TRUNCATE statement: This command is used to delete all the rows from the table and free the space containing the table. SQL DROP Statement: The SQL DROP command is used to remove an object from the database. If you drop a table, all the rows in the table is deleted and the table structure is removed from the database. Once a table is dropped we cannot get it back, so be careful while using RENAME command. When a table is dropped all the references to the table will not be valid. Difference between DROP and TRUNCATE Statement: 32 What is the purpose of joins other than retrieving data from different tables? Join can be used to update, delete or insert data in tables 33 What is the difference between truncate and delete? 1. Truncate is a DDL statement where as delete is DML 2. Truncate cannot be rolled back 3. Truncate is w/o where clause 34 What is referential integrity? A feature provided by relational database management systems (RDBMS's) that prevents users or applications from entering inconsistent data. Most RDBMS's have various referential integrity rules that you can apply when you create a relationship between two tables. For example, suppose Table B has a foreign key that points to a field in Table A. Referential integrity would prevent you from adding a record to Table B that cannot be linked to Table A. In addition, the referential integrity rules might also specify that whenever you delete a record from Table A, any records in Table B that are linked to the deleted record will also be deleted. This is called cascading delete. Finally, the referential integrity rules could specify that whenever you modify the value of a linked field in Table A, all records in Table B that are linked to it will also be modified accordingly. This is called cascading update. 35 An application has a field that accepts numbers between 0 and 100. How many test cases will you create and what approach will you use? test cases required are: For values < 0 for values between 0 and 100 for values > 100 Page 2
  • 3. Database 36 What are the various modules in QC? What are the various tabs in QC? Difference between Test Plan and Test Lab. Tabs in Quality centre : Requirements , test resource , test plan , test lad and defects Difference in test plan and test lab: In test lab we create the folder structure and write the test cases corresponding to a system in test lab we select the test cases written in test plan and execute them as Pass/Fail/NA 37 What is the syntax of grep command? grep pattern string 38 directory? 39 file? 40 What is foreign key? Explain with the help of an example. Why do we require a foreign key? A feature provided by relational database management systems (RDBMS's) that prevents users or applications from entering inconsistent data. Most RDBMS's have various referential integrity rules that you can apply when you create a relationship between two tables. For example, suppose Table B has a foreign key that points to a field in Table A. Referential integrity would prevent you from adding a record to Table B that cannot be linked to Table A. In addition, the referential integrity rules might also specify that whenever you delete a record from Table A, any records in Table B that are linked to the deleted record will also be deleted. This is called cascading delete. Finally, the referential integrity rules could specify that whenever you modify the value of a linked field in Table A, all records in Table B that are linked to it will also be modified accordingly. This is called cascading update. 41 Can a join have WHERE clause in it? yes 42 What is the difference in the resulting set for the following two syntax of JOINs: SELECT * FROM table1, table2 where table1.col=table2.col SELECT * FROM table1 JOIN table2 ON table1.col=table2.col no difference in both… they will yield the same result 43 EmpName , Department). Write query for finding out how many employees are there in each department. select count(emp_id) from employee group by department 44 Query to delete a row from parent table tha has corresponding rows in child table. Delete from tableA Where exists ( Select 1 from tableB where tableA.key=tableB.key and tableB.last_update_dtm=sysdate-30) 45 Basic of Quality Centre. What all tabs are there? Tabs in Quality centre : Requirements , test resource , test plan , test lad and defects 46 can i delete a row from one table which has a refrential integrity on another table yes… using delete cascade option. 47 What are joins? Difference between Left Outer Join and Right Outer Join. The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables. The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2). The RIGHT JOIN keyword returns all the rows from the right table (table_name2), even if there are no matches in the left table (table_name1). 48 what is a view ? where do we use the joins A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database. You can add SQL functions, WHERE, and JOIN statements to a view and present the data as if the data were coming from one single table. SQL CREATE VIEW Syntax CREATE VIEW view_name AS SELECT column_name(s) FROM table_name WHERE condition 49 syntax of update, insert statements. update tablename set columnname=value <where condition> insert into table tablename values (values 1 , value 2 …………….) 50 employee from Staff table. Consider Age is captured as it is in the database table select min(age) , emp_name from staff where emp_id in ( select top 2 age from staff order by age desc) Page 3
  • 4. Database 51 Aggregate functions SQL aggregate functions return a single value, calculated from values in a column. Useful aggregate functions: AVG() - Returns the average value COUNT() - Returns the number of rows FIRST() - Returns the first value LAST() - Returns the last value MAX() - Returns the largest value MIN() - Returns the smallest value SUM() - Returns the sum 52 Difference between count and count(*) in count(*) , null values are counted in count(column name) , null values are not counted 53 Rollback/Commit COMMIT Statement -- commit (make persistent) all changes for the current transaction ROLLBACK Statement -- roll back (rescind) all changes for the current transaction 54 There's a table having 15 coumns and we need to create sample data for it. How will you insert thousands of data in this table. insert into table <tablename> values ('value 1' , 'value 2', 'value3') ('value 11' , 'value1 2', 'value13')….. 55 Difference between Where and Having. Where is used for placing any condition Having is used for placing condition on coloumns using aggregate function in select statement where can be used with or without group by having cannot be used without group by 56 query. select * from employees group by department order by name. 57 DDL/DML/DCL commands. DDL Data Definition Language (DDL) statements are used to define the database structure or schema. Some examples: CREATE - to create objects in the database ALTER - alters the structure of the database DROP - delete objects from the database TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed COMMENT - add comments to the data dictionary RENAME - rename an object DML Data Manipulation Language (DML) statements are used for managing data within schema objects. Some examples: SELECT - retrieve data from the a database INSERT - insert data into a table UPDATE - updates existing data within a table DELETE - deletes all records from a table, the space for the records remain MERGE - UPSERT operation (insert or update) CALL - call a PL/SQL or Java subprogram EXPLAIN PLAN - explain access path to data LOCK TABLE - control concurrency DCL Data Control Language (DCL) statements. Some examples: GRANT - gives user's access privileges to database 58 Why is Alter a DDL and not DML? Because Alter command alters the structure (definition) of table and not the data of the table 59 What is Normalization? usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships. 60 Different forms of normalization. g First Normal Form (1NF): Each field in a table contains different information. For example, in an employee list, each table would contain only one birthdate field. Second Normal Form (2NF): Each field in a table that is not a determiner of the contents of another field must itself be a function of the other fields in the table. Third Normal Form (3NF): No duplicate information is permitted. So, for example, if two tables both require a birthdate field, the birthdate information would be separated into a separate table, and the two other tables would then access the birthdate information via an index field in the birthdate table. Any change to a birthdate would automatically be reflect in all tables that link to the birthdate table. There are additional normalization levels, such as Boyce Codd Normal Form (BCNF), fourth normal form (4NF) and fifth normal form (5NF). While normalization makes databases more efficient to maintain, they can also make them more complex because data is separated into so many different tables. (2) In data processing, a process applied to all data in a set that produces a specific statistical property. For example, each expenditure for a month can be divided by the total of all expenditures to produce a 61 Difference between Primary key and Unique Primary key doesnot allow null value but unique key allows null value. We can declare only one primary key in a table but a table can have multiple unique key(column assign). Page 4
  • 5. Database 62 employee table? 63 What are Indexes and types of Indexs SQL Index Index in sql is created on existing tables to retrieve the rows quickly. When there are thousands of records in a table, retrieving information will take a long time. Therefore indexes are created on columns which are accessed frequently, so that the information can be retrieved quickly. Indexes can be created on a single column or a group of columns. When a index is created, it first sorts the data and then it assigns a ROWID for each row. Syntax to create Index: CREATE INDEX index_name ON table_name (column_name1,column_name2...); Syntax to create SQL unique Index: CREATE UNIQUE INDEX index_name ON table_name (column_name1,column_name2...); index_name is the name of the INDEX. table_name is the name of the table to which the indexed column belongs. column_name1, column_name2.. is the list of columns which make up the INDEX. In Oracle there are two types of SQL index namely, implicit and explicit. Implicit Indexes: They are created when a column is explicity defined with PRIMARY KEY, UNIQUE KEY Constraint. Explicit Indexes: They are created using the "create index.. " syntax. NOTE: 1) Even though sql indexes are created to access the rows in the table quickly, they slow down DML operations like INSERT, UPDATE, DELETE on the table, because the indexes and tables both are updated along when a DML operation is performed. So use indexes only on columns which are used to 64 For database performance which is better sub-query or Join and why? Most of the Cases JOINS are faster then Sub-queries and it is very rare conditions sub-query become faster. In joins RDBMS can create an execution plan that suits better for your query and can predict what data should be loaded to be processed and save time unlike the sub-query where it should run all the queries and load all their data to do the processing The good thing in sub-queries that they are more readable then joins, that's why most of new SQL people prefer them because it is the easy way. but when it comes for performance JOINS are better in most cases even though they are not hard to read too. 65 records and table 'B' have 1000 records, which table will you get scan first for better depends upon the index. Depends on which column index is made and how often it is used while retrieving the data 66 How to create a table The CREATE TABLE statement allows you to create and define a table. The basic syntax for a CREATE TABLE statement is: CREATE TABLE table_name ( column1 datatype null/not null, column2 datatype null/not null, ... ); Each column must have a datatype. The column should either be defined as "null" or "not null" and if this value is left blank, the database assumes "null" as the default. 67 What is normalization and denormalization? tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships. Denormalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access. You may apply Denormalization in the process of deriving a physical data model from a logical form. 68 ETL and schedulers? 69 Cubes? 70 Sort in order Where,Group By,Having and Order by where group by having order by Page 5
  • 6. Database 71 What Is the diff between row id and Row num y q y y , q y where a row resides on disk. The information in a ROWID gives Oracle everything he needs to find your row, the disk number, the cylinder, block and offset into the block. The ROWNUM is a "pseudo-column", a placeholder that you can reference in SQL*Plus. The ROWNUM can be used to write specialized SQL and tune SQL. For example, to only display the first-10 rows, you might apply a ROWNUM filter: select * from ( select * from my_view where alert_level=3 order by alert_time desc) where rownum<=10; In sum, the difference between ROWNUM and ROWID is that ROWNUM is temporary while ROWID is permanent. Another difference is that ROWID can be used to fetch a row, while ROWID only has meaning within the context of a single SQL statement, a way of referencing rows within a fetched result set 72 find the 50th record 73 main table and B is audit table. If I want that whatever changes I make in table A should be updated as an entry in B as log , using trggers Use after trigger --- > apply on insertion of values in table A 74 How would we transfer data from one table to another without creating the first one. CREATE TABLE new_table AS (SELECT * FROM old_table WHERE 1=2); 75 before staging Db eg Empd id is changed from 10 to 20 char. Now what all things would we test: 76 Write query to find duplicate records select * from employee where emp_id not in ( Select distinct emp_id from employee); 77 DB or denormalised Db Normalised DB 78 A depend on B B depend on C C depend on D which way you will create the table and after creating in which way you will delete the table? creation = D C B A Deletion can be in any order using delete cascade option. 79 What is Indexing? Indexes help us retrieve data from tables quicker.Without an index, the database system reads through the entire table (this process is called a 'table scan') to locate the desired information. With the proper index in place, the database system can then first go through the index to find out where to retrieve the data, and then go to these locations directly to get the needed data. This is much faster. 80 a table ? 81 what join type would you use to find out in and out time of employee which 82 How to get the no. of records from a table apart from count (*) function 83 retrieving the records from select * statement, it is showing only 80 records 1. There may be a duplicate records and to retrieve the data distinct clause is used 2. The table may be referencing some other table and through join the record has being fetched 84 table? using group by and having clause 85 using row id? delete from table where column name Not In(select distinct column name from table) 86 Give an example of self join with query? 87 1 st table(employee): employeeID,Name, Salary, Department ID 2 nd table:(Department): Deprt.ID, EmpId, Empdesc 3 rd table:(Salary) Emp ID and Salary 88 What we test in database testing? 89 What is candidate key? 90 Page 6