SQLServer DBA³£見問題
In the latest installment of the SQL Server interview questions, we will outline questions suitable for a DBA interview to assess the candidates skills related to SQL Server system databases. In this tip, the questions are there to read, but the answers are intentionally hidden to really test your skills. Once you read the question and have determined your answer, then highlight the answer to see how you did.
Solution
Question Difficulty = Easy
Question 1: What are the SQL Server system databases and can you outline the general functionality of each database?
Master - Database responsible for SQL Server instance related data. You can also think of this database corresponding to the Windows SQL Server service account.
Resource - Database responsible for SQL Server system objects. This database was introduced in SQL Server 2005 and is intended to ease the upgrade and rollback of SQL Server system objects.
Model - Template database for the creation of new user defined databases.
MSDB - Database responsible for SQL Server Agent related data such as Jobs, Alerts, Operators, etc.
TempDB - Temporary database to store temporary tables (#temptable or ##temptale), table variables, cursors, work tables, row versioning, create or rebuild indexes sorted in TempDB, etc. Each time the SQL Server instance is restarted all objects in this database are destroyed, so permanent objects cannot be created in this database.
Distribution - Database responsible for managing replicated data. This database could reside on the publisher or subscriber.
Additional information: SQL Server 2005 Books Online - System Databases
Question 2: True or False - Can you create objects in the Master, Model and MSDB databases?
True.
Question 3: Is it a good idea to create objects in the system databases?
In general , objects should not be created in the system databases. In general, it is a best practice to create a separate database for user defined objects that would be used instanc
Ïà¹ØÎĵµ£º
SQL-Structured Query Language
--(¿ªÆôSQL·þÎñ£ºnet start mssqlserver)
--(ÔÚÃüÁîÐÐÖÐÊäÈë'sqlwb'ÃüÁî¿É´ò¿ªSQL¹ÜÀíÆ÷ )
--(Èç¹ûÒªÖ´ÐжàÌõÃüÁîÖеÄÒ»Ìõ,Êó±êÑ¡¶¨ºóÔÙ°´F5Ö´ÐÐ)
create database sales --´´½¨Ò»¸öÃûΪsalesµÄÊý¾Ý¿â
on
(
name='sales_dat ......
ÏÖÔÚÒ»°ã³£ÓõÄÓÐÒÔÏÂ2ÖÖ·½·¨:
1. select top @pagesize * from table1 where id not in (select top @pagesize*(@page-1) id from table1 order by id) order by id
2. select * from (select top @pagesize * from (select top @pagesize*@page * from table1 order by id) a order by id desc) b or ......
1.¾ø¶ÔÖµ
S:select abs(-1) value
O:select abs(-1) value from dual
2.È¡Õû(´ó)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.È¡Õû£¨½ØÈ¡£©
S:select cast(-1.002 as int) value
O:selec ......
ÿ´Î´ò¿ªSQLServer²éѯ·ÖÎöÆ÷ºó£¬ÔÚÁ¬½Ó´°¿ÚÀïµÄSQLServer·þÎñÆ÷Ñ¡ÔñÏÂÀ¿òºÍµÇ¼Óû§ÃûÊäÈë¿òÀﶼ»áÁôÓÐÀúÊ·µÇ¼µÄ¼Ç¼£¬ÓÐʱºòÎÒÃÇÊDz»Ï£ÍûÕâÑùµÄ£¬±ÈÈçÔÚÒ»¸ö·Ç˽ÓÐÁìµØ×öÁËÔÝʱµÄ¿ª·¢ºó£¬²»ÏëÁôÏÂÈκÎÁ¬½ÓÔ¶³ÌÊý¾Ý¿âµÄ¼Ç¼£¬ÈçºÎɾ³ýÄØ£¿»¹ÊÇ×¢²á±í£¬ÕÒµ½ÒÔÏ·¾¶£º
HKEY_CURRENT_USER\Software\Microsoft\Microsoft&n ......
SQLServerʱ¼äÈÕÆÚº¯ÊýÏê½â,SQLServer,ʱ¼äÈÕÆÚ,
1. µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
select getdate()
2. dateadd ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
À ......