Vous êtes sur la page 1sur 28

S.

NO

2
3
4
5
6
7
8
9

10
11

12

13
14

15

16
17
18

19

20
21

22
23

24

25
26
27
28
29
30

31

32

33
34
35

36

37

38

39
40

41

42

43
44

45

46

47
48
49
50
51
52

53
54

55

56

57

58
Queries

Questions

How do you get the second max date in the date column?
There are two tables ,A(id,name),B(id,cellphone).write a query to find all employees have
cellphones ?
You have table A(id,Mgrid).Given an id ,write a query to get mgrid?
How do you identify the duplicate record in your table?
Table1 (name,id) ,Table 2( id, book) write query to get name and books with given id
How to add column
How do you select Not Null values from a table
Find out the second Max value in a Table
What will the query returns select a,sum(b) from table group by a
There are three tables A(col1,col2),B(col1,col2),C(col1,col2,col3) what will be the result
Select A.col1,B.col1 from A,B,C where A.col1=B.col1
Delete 500,000 row from a table how do you achive this?
There are two tables one with 100 rows and other with 10000 rows How to join this two
tables?
In person table which has fname,lname,age,address . write a query to get all the duplicate
fname and lname
What are the different ways in which we create Temp table?
We feed 500000 row with data for 90 days each day new data is feed with old data purged,
how would you do it?
Stundent(sname,sid) and courses(cname,cid,sid) are two table,find what are all the courses a
specific student has taken?
How will you insert 10000 row into a table?
You have Table1(id,name),Table2(id,class) select all matching rows from both the table
If there are table with fname,lname and group and first two column have duplicates,write a
query that provides the duplicates in the first two columns and their corresponding count(no fo
times they are duplicated)
Table given A and B select all rows from both tables and matching rows only once such that
final result set will have id,class,name and should display null for empty values.
How do you select next 100 row in a table?
In a table1(name,address,mark) write a query that select name if mark in positive and address
if marks are negative
How will I get 2000 rows from 50000 rows from one database and put it in another database
Suppose there is table with 3000000 records and I have to delete record that are 20 days old
how will I do that?
A table have 3 columns A,B,C values are 1131152312231523293412345434563445 write a
query to get the 1st occurance of repeating patterns in first two cloumns(no cursors)
I have 1 million rows in a table and I want to delete the first ten thousand rows of the table but
I do not want to log it?
The table Emp with (name,dept,id,salary) find max salary among all the emp in dept wise.
Find the name from EMP which strats with a or b or c.
How do write a query to eliminate the redundant rows in a table?
How do you select 3 & 4 from tables that already has an identity column?
You have table customer and order with cusid and ordid respectively and cusid is also present
in order table ,write a query to get all the customer without order?
Employee table contain id,name,depid,managerid write a query to select
id,name,deptid,mangerid,mangername. Manager also an employee
Table has a column varchar(10) that contain numeric and alphanumeric values ,I want alpha
numeric value how shall I get it?
How to get top 10 empname and salary
How to find 10th max in a table
A table contains 2 column deptid and empid write a query to select all deptid which has more
than 25 empid?
In a table one million rows and one column are in sequence order (1 to million) and there is
one row was missing in that sequence how do I find it?
In a table with column accountid,orderno,order ,managername asked to find the total number
of order placed by a particular manager(accountid,orderno) is a composite key
I have two table A and B ,In both a tables contain the same number of columns and rows
however table A has one extra row ,how will I get that row from table A.
Suppose you have two tables ,how to get the unique rows from both the tables?
In a table A have Id and deposit and table B have id and withdrawal ,write a query to retrive
the final amount I.e deposit-withdrawal
There are two tables emp1(all employees working last year) and emp2 (all current
employees).Now some employees from last year could have left the company and no longer
there in emp2 and some employees are recent hires who are not in emp1 but in emp2 ,How
will you find all the employees who worked in both years.
There are two tables emp1(all employees working last year) and emp2 (all current
employees).Now some employees from last year could have left the company and no longer
there in emp2 and some employees are recent hires who are not in emp1 but in emp2 ,How
would you find all the employees who not present in both tables(ie both newly hired or fired)
How will you delete two row from two tables at same time.
There two tables ABC and PQR,ABC has column A,B,C and Table PQR has P,Q,R. I want
to display A,B,C,P,Q and statisfying the condition that the column A matches column P.
How do you find the(1/2) intersection between two tables (emp1,emp2) or something to that
effect?
I have two tables A and B ,A has id and name ,B has id and marks,Display name and print '0'
for no matching id in table 2 else print 1
How do you find 5th max salary from the emp table?
How do you insert 10 rows at a time to a table?
Write a query for selecting all persons with lastname like'smith'(anycase)from a table?
How do you match particular numbers in a integer column?
How do you find rows that are not common in two similar tables?
There are 10 rows in a table and you want to duplicate the rows into the same table and the
keys of the duplicate rows is unique?
Display the name starts with small letters?
If I have 1000 rows in a table of emp and want to retrive max salary of the emp what query
can I write?
Given two tables A and B having 3 and 2 columns respectively,If I run select * from A,B what
will be the number of rows?
You have two tables A and B with column C1 In A column C1 has value like 1,2,3 and Table
B column C1 has value like 3,4,5 ,How many rows would the following query return 'select *
from A,B where A.C1<>B.C1
We have two table security and type wich has no primary key and foreign key,I need one of
the columns(with only specific rows) from the second table.
Datatypes

S.No Questions

1 What is the use of Timestamp?


2 What are the datatypes available in sybase?
3 How will you change the datatypes of an existing column?
4 What are user definrd datatypes why do we need it?
5 Does datatypes listed in sysobjects?
6 Compare char and varchar datatypes?
7 How do you delete the identity gaps in identity columns?
If you change the datatype of a particular column,how will you know
8 that it is working in case of a large table .
9 Compare money and smallmoney?
10 What is the differnce between Decimal and Float datatype?
11 What is Bit datatype?
Tables

S.No Questions

1 What problem we face when we updating our tables?


2 Write an algorithm to update the tables in batches?
What will be the condition in your while loop to update the table in batches? How
3 do you come out of this loop?
4 How do you delete duplicates rows in a table?
What happen if we use a function in a where clause in a query?will the indexes be
5 applied?
6 What is the restriction for a table that is used in a outer join?
7 What loop constructs does sybase support?
8 How do you avoid divide by 0 in select query?
9 Create a table in sybase?
10 Write a query using group by ?
11 What is Null?
12 What are Temporary table?
13 What is a left Outer join and Right outer join?
14 Compare drop and Truncate?
15 What is the Syntax to change table structure?
16 Compare delete and truncate?
17 In query which is better not In or not Exists?
What is the difference in creating Temp table using select into and create
18 command?
19 Is there any alternative to Identity column?
20 How can you transfer table from one server to another?
21 What is compute and compute by?
22 Is there any specfic order fo tables in from clause while joining the tables?
23 Is sybase support cross tab query?
24 What is federated schema?
25 Explain the snow flake schema?
26 How many nested subquery is possible on a table?
27 What is cascade delete in sybase?
28 Can you truncate table on Foreign key?
29 Compare primary key and Unique key?
30 Compare where clause and having clause?
31 What is table Partitioning?
32 what are the different types of Temp table?
33 Compare having and group by?
34 Compare selfjoin and outerjoin?
35 Compare use and require?
36 What are the types of joins?
37 What is replication server in sybase?
38 How to get the third max value in a table using self join?
39 What creates a worktable?
40 When is 'not in' preffered to 'not exists'?
41 Whan do you use a table scan?
42 How do you trace changes to a work table in sybase?
43 Compare union and union all?
44 Comapre exists and like?
45 What is cross join?
46 What are the difference types of System databases in sybase 11 ?
47 How do find No of rows in a table ?
48 Compare count() and Count(*)?
49 Which is faster 'select into' or 'insert' statement?
50 How to set max rows per page?
51 What are trace flags?
52 What are Joins and why join order is importance?
53 How do you set the join order?
54 What are cascade update,delete and insert ,How do you implement them?
55 Explain Referencial integrity?
56 How do you insert row into the tables?
57 Explain about Identity column?
58 What is IN and NOT IN?
59 Give me the syntax for left outer join?
60 What is group by ?
61 How do you extract data from tables?
62 How can you avoid distinct and data is not unique?
63 Compare T-sql and Sql?
If two tables are given we need to convert row information to column
64 information ?
How will you organise data for different kinds of account into sybase tables so that
65 minimum amount of space is used?
66 What is correlated subquery?
67 Compare in and exists?
68 When the table scan is useful?
69 Why is multiple tempdb in version 12X useful?
70 What is the difference between select into and insert?
71 What is temp table and hash table?
72 Name few system tables?
73 What is sybase replication?
74 What is difference between having and group by?
75 Compare TSQL and ANSISQL?
76 How do I delete particular column without using alter command?
77 What is session table in sybase?
78 Can you use having without group by?
79 What are the difference between outer and inner joins?
80 How do you select only limited portion of table ?
81 What is the difference between sybase12 and sybase11?
82 What are the priviliges you as a table owner can grant someone on your table?
83 Why do you use trigger rather than Referntial integrity?
You have table A and table B ,b is smaller than A and if we use outer join what
84 join order will sybase use?
85 How will you use sybase to execute a query only on month ends?
86 How do you set the number of tables to join?
87 What are the risk in using Temp tables?
88 What is intersect Query?
89 How to update a table but using a join condition with other tables?
What are all the problem when you use group by only on some non aggregates in
90 select clause?
If you have to begin,commit and rollback tran in your query ,can you create the
91 temp table in that transaction?
92 What is revoke permission?
93 What is check constraints?
94 What is the advantage and disadvantage of #table?
95 How do you check the query for syntax?
96 How to detemine what permissions user have like the read,write or execute?
97 How do you handle error in sybase?
How do you change your login password in sybase and will user have the rights or
98 only admin can do it?
99 What is the difference between Sybase and Oracle?
100 What is the use of wildcards?
101 What are the different types of Aggregate functions?
102 Insert ,Delete is better or update is better?
View

S.No Questions

1 What is the use of view ?


2 What is View?
3 What are the limitation on view while creating it?
4 Can I update a View?
5 What is the use of creating view with check option?
Cursor

S.No Questions

1 What are the cursor advantage and disadvantage?


2 Compare cursor and setbased?
3 Which one is better using cursor or other method?
4 How do you write cursor inside the SP?
5 How do we deallocate the cursor?
6 How shall we overcome the disadvantage of cursor?
7 How will you access row by row in sybase?
8 What are steps involed in creating cursor?
9 Explain cursor and performance?
10 What is @@sqlstatus?
Stored Procedures

S.No Questions

Why did you use SP to update your main server?Didn’t you any other techinque or
1 tool to do that?
2 What is SP & how it is different from a trigger?
3 What is Stored procedure?
4 What are the types of parameter a SP can accept?
5 How do you create a SP?
A table contain 3 columns & SP has select * from table .If I add a new column to
6 that table & run the SP what will be the output?
I have 200 SP having a select * from table query.I have changed the table coulmns.
7 How do I update the Sp to handle the new/deleted columns?
8 What are the SP advantage and disadvantage?
We have two SP within Transaction and one SP wants to access the Temp table
9 present in the first SP and also has insert statement within it?
10 How to handle error in SP?
11 Compare sp_recompile and with recompile?
12 How many input parameters you can pass through the SP?
13 How would you call/pass arguments in SP?
14 Compare Sp and function in sybase?
15 What is the limitation of the SP?
16 What is the use of SP?
17 What is extented Stored procedures?
A SP calls another .If a #table is created in the first SP can it be accessed in the
18 other SP?
19 Which is more advantage trigger or SP?
20 Advantage of SP?
21 Disadvantage of SP?
22 Compare batch and SP?
23 How do pass parameter in SP?
24 What is nesting levels in SP?
What is the difference between a return (0) and a return(X) ,X being any integer in
25 a SP?
26 How do you declare the local variables in SP?
27 What are the ways to communicate SP from application?
If there are three Transaction inside a SP is first and last was commited but middle
28 was failed what will be the return status?
29 How would you update SP if the tables are modified?
30 Can we access table from different database using SP?
31 How do you read the text of the SP?
32 Trigger or SP which one remain in the cache?
33 What is recursive SP?
S.No

1
2
3
4
5
System Stored Procedures
Questions

What is sp_helpdb,sp_helpindex?
What is sp_who?
How do you check the text of the SP?
How do you find the size of the database in sybase?
What is sp_dboption?
Global Variables

S.No Questions

1 What are the different global variables?


2 For cursor what is the possible values of @@sqlstatus?
3 How do you get the version of the sybase?
4 How do you view only top 30 rows of the table?
5 What is @@identity?
Trigger

S.No Questions

1 What is a Trigger?
2 How many trigger can you have on a table? What are they?
You are inserting a million rows into a table having an insert trigger .will the
3 trigger execute a million times?
4 What are magic table and where are they accesiable?
5 How do you create a Trigger?
6 What are the different types of Trigger?
7 Why we need Trigger?
8 How Trigger checks for a particular data update?
9 What are the Trigger advantage and disadvantage?
10 How do find how many rows are deleted using delete command?
11 Explain the Trigger in a Update scenario?
What happen if you create delete trigger on a table which have aleady delete
12 trigger?
13 How to find out trigger on tables?
14 How to get program listing of trigger on a tables?
15 Why do we need Trigger?
16 Compare truncate and trigger?
17 What are he trigger upper limits on a table?
18 Which one will fire first trigger or Referential integrity?
19 What is the difference between Trigger and Cursors?
20 What are the limitation on Trigger?
S.No

2
3
4
5
6

7
8
9
10
11
12
13

14
15
16

17
18
19
20
21
22

23

24

25
26
Index

Questions

What happens to data when a clustered index is created? What happens if non-clustered
index is created?
There is non-clustered index on a table.I create a clustred index on the same table without
dropping the non-clustred index.what will happen to the data?Wether one index affect the
other?why?
How do you force the omptimizer to use the index for a table?
What are the difference between clustered and Non clustered index?
Can you tell me the scenarios when you used the two types of index ?
What are the different types of Indexes?
There is an index on lname and another index on(lname,fname) in a table .if we write a
query to select lname like 'smith' which index will be used if it is used?
How do you add an index to a column?
What is the difference between primary key and indexes?
How many clustered and non clustered index on a table?
How to sort data in a table in a table without using order by and without using indexes?
How many indexes can you have in a table and in a column?
Can you create indexes on temporary tables?
Consider in table1 -empid has numeric value and table2 -empid have int value if there is
query that joins the two tables which indexes will be used and why?
What is the use of clustered and non clustered index?
How do you list out all the indexes on a table?
Suppose an index has a composite key(a,b,c,d) and we do a select on b and c will it use the
index?
How many index a table can have?
What is pros and cons of indexes?
Give me the advantage and disadvantage of forcing the index?
Why index are used in select query what is the reasons?
If you have an index on five column do you have to specify all the five in where clause?
I have a query using 'like' to search on a column ,The table having 10 million rows ,which
index should I have on that column to optimise my search?
A table contains EmpId ,name,dept and gender there are two indexes namely
on(dept,gender) and (gender,dept) now you write a query select * from table where dept=" "
and gender="" which index would it take and when?
You have table with column just contain value like 'male' or 'female' ,what index would you
apply and why?
How would you implement a merge sort in indexes?
Locks

S.No Questions

1 What are the different locks in sybase?


How to detect deadlock,how do you avoid the deadlock,What will sybase do when
2 deadlock occurs?
3 How do you trace the deadlock?
4 what is lock escalation?
5 what is row level and page level locking?
6 What is lock?
7 What is row level,page level and table level locking which is better and why?
8 How do you avoid Deadlock?
9 How many types of locks are there in sybase?
10 What are Locks?
11 What kind of lock will be put on data while performing insert,update or delete?
12 How do you determine the different locks aquired on a table?
13 How can you force the lock on a table?
14 What is the locking level in sybase?
15 How do you move from page level to table level lock?
16 How to see the types of locks on all tables?
17 What would be the status of sp_lock in a deadlock?
18 How to see deadlock information in sybase?
19 What is demand locks?
20 What is the advantage of table level over row level lock?
21 Compare deadlock and Blocking?
Sybase Tools

S.No Questions

1 What are the types of BCP?Explain their difference?


How can I select the first 500 rows from a table having million rows & generate a
2 flat file?
3 Is the trigger fires during BCP in?
There is delete trigger on a table and there is no indexes wether server use fastbcp
4 or slowbcp?
5 Is it possible to lookup the missing data before loading it into sybase tables?
6 What sort of checks can be done in BCP?
7 How do handle error in BCP?
8 How do you upload the data?
9 How would you transfer certain number of rows from table to file?
10 How data validation works before bcp?
11 In which case fast bcp occurs?
which one of the following gets fired when you do a bcp into a table from a file?
12 defaults,rules,trigger,constraints?
13 What is the option for identity column in bcp?
14 What steps did you take to tune the BCP?
15 When should we use BCP and Insert statements to modify table ?
16 How do you send a selected rows into a file?
17 In bcp how would I specify that only one error is allowed?
18 In bcp how would I specify that commit size?
19 How would you transfer 1000 rows from 10000 rows using BCP?
20 How do you do fast bcp with trigger and indexes on the table?
21 How do you copy output to a file using isql?
22 What is the default field delimeter in bcp?

23 How does the following command know host and port number of the server isql -S?
24 What does -E mean in BCP?
25 How do you handle error in bcp?
How can you bcp only selected set of rows from a table to file with some
26 conditions?
27 How do you write an sql from sybase server to os file?
28 What is interface file?
How do you do bcp in to table from a file which has 2 columns seperated by a
29 comma and one of the column has values with in quotes?
30 What is the latest tools that can be used to improve the performance?
Isolation Levels

S.No Questions

1 What are the Isolation levels?


2 Can you set the isolation level for single query?
3 What is different between level 2 and level 3 in Isolation?
4 How shall I stimulate from level0 to level3?
5 What is dirty read and how it is deferred from phantom read?
6 What is Isolation level 3?
Performance Tunning

S.No Questions

You have a UpdateTrigger on a table containing a million rows, I update all rows
1 in the table.What will be the performance issues?
2 If one of my updations fail what is your solution towards it?
3 Explain the steps involed in Tunning the Databases?
4 How do you Tune a SP ? Explain all steps?
5 What is your first steps towards Query optimizing?
6 How did you know index was the cause of the perfomance degration?
7 What is show plane used for?
8 What is Ghost Record?
9 What is optimization?
10 Why denormailzation is needed?
11 What is Normailzation?
If we are joining two tables and what matter join is not working propely suggest
12 some efficient manner to solve it?
13 What are the performance issues in cursor?
14 How do you force the join order?
15 What is index covering?
16 What is Update Statistics?
17 where do you use update statistics and why?
18 What are the reasons for a query to run slow?
19 When is subquery used or avoided?
20 What are the techniquies followed in denormailzation?
21 What does set rowcount do?
How do you restrict multiple users from using a particular table to avoid
22 discrepencies/overlapping of table values?
23 What Indexing will be better for larger master table?
24 Which one we prefer joins or subqueries?
25 What is distribution page?
26 What does reformatting mean in the output of the showplan output?
27 What does deffered in the output of the show plan ?
28 When we use set statistics time on ,what are the different times we see?

I have two tables item and order are newly created without any rules,constraints
29 etc. and I run a query involing both tables it run s very slow what can I do about it?
30 What is proactive Tunning?
31 What is reactive Tunning?
32 Whan would you prefer to do use a stored procedure than a Trigger?
33 What happen when you are deleting 100 rows?
34 Explain about dbcc 3604 and dbcc 3605?
Transaction

S.No Questions

How does sybase know to what extent a transaction has to be rolledback?how do


1 you check wether the rollback was correct or not?
During updating the table can you access the previsoly held data?How is it
2 internally stored in Sybase?
There are million rows to be inserted & the transaction log gets filled up soon .
3 How do you avoid this situation?
4 What is Transaction?What happen internally when a transaction take places?
5 What is Transaction Blocks?
6 How do take care of transaction while updating tables in batches?
If you have to rollback when a batch updation fails,how would you determine to
7 what extent you have to rollback?
What is the use of checkpoint?what happen internally when a checkpoint is used?
8 how does sybase rollback a transaction to the checkpoint ?
9 How do you truncate transaction log?
A situation aries where two user are updating a table Simultaneously,How do you
10 maintain the data consistency?
11 What is savepoint?
What happens if the last record is having an error how many records would be
12 updated?
13 Compare chain and unchain mode in Transaction?
14 How do you know who are the user logged in the database?
15 What are the way to figure out that transaction log is full?
16 What is commit?
17 What is Transaction log and how is it maintained in syabse?
18 What are the different modes of transaction?
In Transaction table1 has unique values,table2 has id which has duplicate rows
19 .begin tran insert into table1(id) select id from table2 commit ,what will happen?
20 Explain about transaction save points and check points?
21 What is transaction management?
22 What is the default transaction level?
I am doing an update on table and a trigger is fired which fails then is the update
23 rolled back?
24 How does sybase handle rollback?
If you have to begin,commit and rollback tran in your query ,can you create the
25 temp table in that transaction?
26 Why the transaction log is called write a head log?
27 what is the difference between log segment and data segment?
28 How do you find out that transactio log is full?
29 What is the default transaction level?
I am doing an update on table and a trigger is fired which fails then is the update
30 rolled back?
Built In Function

S.No Questions

1 Name some of the Buit in functions?


2 Tell me about what are the different String functions in Sybase?
3 How will you find the pattern in a string on sybase?
4 When you execute the query select xx(G,'ABCDEFGHI'),what is xx?
5 How do you calculate last month's day?
6 How to get the yesterday's date?

Vous aimerez peut-être aussi