• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

MS SQL Interview Questions Answers

Question - 1 : - How does a differential backup know which extents have changed so that it can be very quickly run?

Answer - 1 : - The DCM tracks changes. The differential backup reads the extents from this structure. A differential backup uses the Differential Change Map to determine which extents have changed and need to be include in the backup. This greatly speeds the differential backup process.

Question - 2 : - how to Install a MySQL Binary Distribution?

Answer - 2 : - You need the following tools to install a MySQL binary distribution: GNU gunzip to uncompress the distribution. A reasonable tar to unpack the distribution. GNU tar is known to work. Sun tar is known to have problems. An alternative installation method under Linux is to use RPM (RedHat Package Manager) distributions. If you run into problems, PLEASE ALWAYS USE mysqlbug when posting questions to mysql@lists.mysql.com. Even if the problem isn't a bug, mysqlbug gathers system information that will help others solve your problem. By not using mysqlbug, you lessen the likelihood of getting a solution to your problem! You will find mysqlbug in the `bin' directory after you unpack the distribution. The basic commands you must execute to install and use a MySQL binary distribution are: shell> groupadd mysql shell> useradd -g mysql mysql shell> cd /usr/local shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - shell> ln -s mysql-VERSION-OS mysql shell> cd mysql shell> scripts/mysql_install_db shell> chown -R mysql /usr/local/mysql shell> chgrp -R mysql /usr/local/mysql shell> bin/safe_mysqld --user=mysql & You can add new users using the bin/mysql_setpermission script if you install the DBI and Msql-Mysql-modules Perl modules. A more detailed description follows. Pick the directory under which you want to unpack the distribution, and move into it. In the example below, we unpack the distribution under `/usr/local' and create a directory `/usr/local/mysql' into which MySQL is installed. (The following instructions therefore assume you have permission to create files in `/usr/local'. If that directory is protected, you will need to perform the installation as root.)

Question - 3 : - procedures on the 2005 server. Why not?

Answer - 3 : - You need to enable RPC. By default, RPC is disabled in SQL Server 2005. You need to set the "remote access option" in your server configuration to 1 to allow the execution of stored procedures from a remote server.

Question - 4 : - Replication Features and known problems?

Answer - 4 : - Below is an explanation of what is supported and what is not: Replication will be done correctly with AUTO_INCREMENT, LAST_INSERT_ID, and TIMESTAMP values. RAND() in updates does not replicate properly. Use RAND(some_non_rand_expr) if you are replicating updates with RAND(). You can, for example, use UNIX_TIMESTAMP() for the argument to RAND(). LOAD DATA INFILE will be handled properly as long as the file still resides on the master server at the time of update propagation. LOAD LOCAL DATA INFILE will be skipped. Update queries that use user variables are not replication-safe (yet). Temporary tables starting in 3.23.29 are replicated properly with the exception of the case when you shut down slave server ( not just slave thread), you have some temporary tables open, and the are used in subsequent updates. To deal with this problem, to shut down the slave, do SLAVE STOP, then check Slave_open_temp_tables variable to see if it is 0, then issue mysqladmin shutdown. If the number is not 0, restart the slave thread with SLAVE START and see if you have better luck next time. There will be a cleaner solution, but it has to wait until version 4.0. In earlier versions temporary tables are not being replicated properly - we recommend that you either upgrade, or execute SET SQL_LOG_BIN=0 on your clients before all queries with temp tables. MySQL only supports one master and many slaves. We will in 4.x add a voting algorithm to automatically change master if something goes wrong with the current master. We will also introduce 'agent' processes to help doing load balancing by sending select queries to different slaves. Starting in Version 3.23.26, it is safe to connect servers in a circular master-slave relationship with log-slave-updates enabled. Note, however, that many queries will not work right in this kind of setup unless your client code is written to take care of the potential problems that can happen from updates that occur in different sequence on different servers. Note that the log format has changed in Version 3.23.26 so that pre-3.23.26 slaves will not be able to read it. If the query on the slave gets an error, the slave thread will terminate, and a message will appear in the .err file. You should then connect to the slave manually, fix the cause of the error (for example, non-existent table), and then run SLAVE START sql command (available starting i

Question - 5 : - What does TIMESTAMP ON UPDATE CURRENT_TIMESTAMP data type do?

Answer - 5 : - On initialization places a zero in that column, on future updates puts the current value of the timestamp in.

Question - 6 : - What is the difference between a return parameter and an OUTPUT parameter?

Answer - 6 : - If the applicant is able to answer this question correctly, the odds are good that they have some experience working with stored procedures. A return parameter is always returned by a stored procedure, and it is meant to indicate the success or failure of the stored procedure. The return parameter is always an INT data type. An OUTPUT parameter is designated specifically by the developer, and it can return other types of data, such as characters and numeric values. (There are some limitations on the data types that can be used as output parameters.) You can use multiple OUTPUT parameters in a stored procedure, whereas you can only use one return parameter.

Question - 7 : - If you run this, what does it return? select applock_mode('public', 'SalesApp', 'Transaction')

Answer - 7 : - The type of lock being held by an application that requested it. This command returns the lock mode held by an application that was requested with the sp_getapplock procedure. insert mytable select '' insert mytable select ' ' select * from mytable where mychar = '' select * from mytable where mychar = ' '

Question - 8 : - How do I retrieve only the date or time portion of the data?

Answer - 8 : - You can use T-SQL's DATEPART() function to return a subset of the values that SQL Server's datetime columns store. The DATEPART() function uses two arguments. The first argument specifies the portion of the date that you want, and the second value specifies the datetime column: SELECT orderID, DATEPART(MM,OrderDate) AS OrderMonth FROM Orders

Question - 9 : - How do you get a portion of a string?

Answer - 9 : - SELECT SUBSTR(title, 1, 10) from techpreparation_questions;

Question - 10 : - Can you save your connection settings to a conf file?

Answer - 10 : - Yes, and name it ~/.my.conf. You might want to change the permissions on the file to 600, so that it’s not readable by others.

Computer Contributors

Rajeev Katiyar
Yes Baroda

Share your email for latest updates


Our partners