Data Modeling & System Databases and Tables & Data Definition
101 |
Creation of view will result in a following table being updated |
Books-online: When you create a view, the name of the view is stored in the sysobjects table and the view's normalized query tree is stored in the sysprocedures table. Information about the columns defined in a view is added to the syscolumns table, and information about the view dependencies is added to the sysdepends table. In addition, the text of the view creation statement is added to the syscomments table. This is similar to a stored procedure; but when a view is executed for the first time, only its query tree is stored in procedure cache. Each time a view is accessed, its execution plan is recompiled. |
100 |
Creation of table will create an entry in |
????? |
|
107 |
A null value is |
|
91 |
How to ensure that pub_id which is not in publishers, is not inserted in titles. |
????? |
|
92 |
Two tables with common attributes , they are in |
????? |
|
96 |
The logical attribute of physical entity is called |
|
108 |
The features of primary key are ? |
???? |
|
109 |
Ensuring that primary key is unique and does not allow null value is called |
|
110 |
The various database objects are? |
Books-online: Database Object Owner Database objects are tables, indexes, views, defaults, triggers, rules, and procedures. |
14 |
Where are user-defined stored procedures stored? |
|
15 |
In which database are system stored procedures stored? |
|
16 |
Which database have the sysobjects table? |
|
17 |
In which database will the table be created with the create table ##tableName be stored? |
|
34 |
A user create a temporary table #tmp1. If he wants the table to be accessed by everyone he should? |
|
36 |
Where will be temporary info is stored in server when we issue an SQL command using the DISTINCT clause? |
|
45 |
The optimizer hint can be specified in |
|
46 |
A table has two indexes . The no. of pages utilized is ? |
1 extend (for the table) + 2 extend (for the 2 indexes) = 3 extends * 16Kb = 48Kb |
77 |
The device info is stored in |
|
|
78 |
SELECT * INTO #tl FROM cust. Where will #tl be stored? |
|
50 |
System error messages are stored in? |
|
51 |
Every database |
|
52 |
The default size of tempdb is |
|
53 |
The SQL EXECUTIVE SERVICE schedule is supported by |
|
54 |
Syshistory is used to |
|
66 |
Sales db uses a device DEV1 and the transaction log is using LOGDEV2. The Log device is full. Disk resize has already been given on the device LOGDEV2 and to increase the size of the transaction log, the command given is |
ALTER DATABASE Sales on LOGDEV2 =
25
|
55 |
Devices are referred to in SQL statements using the |
|
56 |
When we require to create a device the command to use is |
|
57 |
Removing master device from being as default is |
|
58 |
While dropping a device I want to remove a physical file from the disk, the command sp_dropdevice . DELFILE is an |
|
59 |
Modifying database is done using |
|
60 |
To reduce the size of a database you need to be |
|
67 |
Sales db uses a device DEV1 and the transaction log is using LOGDEV2. The Log device is full. To increase the size of the transaction log , the command given is |
DISK INIT and the ALTER DATABASE
|
73 |
How will you create your own error messages with a column name? |
|
74 |
There is a table called cust_order existing. At the end of every month the sum of order qty will be added in to a table called cust_summary. So what is the relationship between cust_order and cust_summary? |
|
76 |
How does Foreign key used to maintain referential integrity? |
|
76 |
How do you enforce integrity in a two tables that have a many to many relationship. An exhibit is given with the primary keys and foreign keys defined. |
?? |
|
114 |
There are 3 tables title, author and titleauthor . The rule posed on the 3 tables is that, every author should have written 0 - many books and every book should have at least one author. The titleauthor table connects titles and the author table. During the creation of the table how will you ensure these rules? |
???? |
|
19 |
How do you increase the size of the transaction log? |
Books-online: ALTER DATABASE statement |
79 |
To increase the size of transaction log, the following statement is used |
ALTER SALES ON LOG_DEV =25
|
133 |
You want to dump the transaction log, but the transaction has some free space which one will you choose? |
????? |
|
21 |
How can you prevent transaction log from filling up? |
|
82 |
How do you prevent a log from filling up? |
|
89 |
To increase the size of the device I give the following instructions |
DISK INIT Name = ..... Size = 9000
|
90 |
Log is full; you have created a device called mydevice. DISKINIT has already been used . ALTER database on mydevice = 5 is given to increase the log size |
|
Retrieving Data & Modifying Data
118 |
There is a publisher table and a title table. All the publishers who have published books whose average price is > $10 is to be listed. |
FROM publishers a , titles b HAVING AVG(price) > 10
FROM publishers a , titles b WHERE a.pub_id = b.pub_id AND AVG(price) > 10
FROM publishers a , titles b GROUP BY a.pub_id, a.pub_name HAVING AVG(price) > 10 |
20 |
You have two tables: titles and salesitems |
You want to list sum of all titles by category which have sales. FROM titles t, salesitems s WHERE t.titleID =* s.titleID GROUP BY category, title FROM titles t, salesitems s WHERE t.titleID = s.titleID GROUP BY category, title HAVING SUM(qty) >= 0 FROM titles t, salesitems s WHERE t.titleID = s.titleID OR qty=0 GROUP BY category, title FROM titles t, salesitems s WHERE t.titleID *= s.titleID GROUP BY category, title |
26 |
To get a report of all the publishers names whos published titles average price is greater then $10? |
SELECT name, AVG(price) FROM pubs WHERE AVG(price) >= $10 GROUP BY name
|
2 |
Which two of the following statements are a valid column alias change: |
|
11 |
You want to count how many number each different states have suppliers? |
|
39 |
The titles table has l_name and f_name columns. Write the SELECT statement to display the two in one columns. |
Books-online: SELECT statement |
47 |
In order to find count of all unique cities from the author table, which SQL statement would you use? |
Please refer to question 11. |
|
84 |
Display the name, price of the item, if price of item is null, then 0.00 has to be displayed, Choose two answers |
|
85 |
Display the count of unique titles |
Please refer to question 11. |
86 |
Display the employee name and manager name from the table emp(emp_id, name, mgr_id) |
FROM emp a, emp b WHERE b.emp_id = a.mgr_id Please refer to question 13. |
49 |
The user wants to find out all those, which had some sales. The sql command given is: |
SELECT title_id FROM titles WHERE
title_id = (SELECT title_id FROM sales) The above sql is:
|
13 |
You have an employee table and want to list all employees and their managers? |
CREATE TABLE employee ( employeeID int NOT NULL, employeeName varchar(50) NOT NULL, ... managerID int NOT NULL )
FROM employee, employee WHERE 1.employeeID = 2.employeeID
FROM employee a, employee b WHERE a.employeeID = b.managerID
FROM employee a, b WHERE b.managerID = a.employeeID
FROM employee a, employee b WHERE b.managerID = a.employeeID |
69 |
Which one is faster, TRUNCATE or DELETE? |
|
75 |
What is HoldLock? |
|
14 |
To retrieve the database ID and the username: |
|
120 |
How will you view the name of the current user and database? |
Please refer to question 14. |
121 |
How will you view all the books whose type is cooking? |
|
122 |
To list all the books starting with 'computers' |
SELECT * FROM titles WHERE name =
%computer%
|
117 |
There are 2 tables cust_summary and cust_info. The cust_info table contains columns like cust_id, amount, name etc,. The group total of amount for each customer is calculated and updated in the total_amount of the cust_summary table. It should be seen that the cust_summary table is not updated when these updation are taking place. |
?? | BEGIN TRAN SELECT cust_id, total = SUM(amount) INTO #cust1 FROM cust_info BROUP BY cust_id HOLD LOCK UPDATE cust_summary SET a.total_amount = b.total FROM cust_summary a, #cust1 b WHERE a.cust_id = b.cust_id COMMIT TRAN END TRAN
|
124 |
You want to wait for 10 minutes what will you do? |
Books-online: WAITFOR statement DELAY Instructs SQL Server to wait until the specified amount of time has passed, up to a maximum of 24 hours. |
126 |
How to insert in values in the row by the user defined order? |
Books-online: INSERT statement |
94 |
I have a table travel, custno is primary key and I have a column called t_id which I want to be unique what will I do? |
?????????????????????????? |
119 |
To ensure an Update-in-place? |
|
116 |
Which 3 of the following will ensure for a fast BCP? |
|
11 |
What can be done with Alter table? |
|
37 | How would you see all the records 30 days before todays date? |
|
22 |
You have an address which has for some rows two columns, an for some rows three columns. All the columns are of the type varchar(50). What will you do in a CREATE TABLE statement? |
|
25 |
How to distinguish a table in a self join? |
|