Samsung SDS Frequently Asked SQL Server Interview Questions Answers

What is the difference between GETDATE and SYSDATETIME?

Both are same but GETDATE can give time till milliseconds and SYSDATETIME can give precision till nanoseconds. SYSDATE TIME is more accurate than GETDATE.

How data can be copied from one table to another table?

INSERT INTO SELECT

This command is used to insert data into a table which is already created.

SELECT INTO

This command is used to create a new table and its structure and data can be copied from existing table.

What is SQL injection?

SQL injection is an attack by malicious users in which malicious code can be inserted into strings that can be passed to an instance of SQL server for parsing and execution. All statements have to checked for vulnerabilities as it executes all syntactically valid queries that it receives.

Even parameters can be manipulated by the skilled and experienced attackers.
Samsung SDS Frequently Asked SQL Server Interview Questions Answers
Samsung SDS Frequently Asked SQL Server Interview Questions Answers

How can we get count of the number of records in a table?

Following are the queries can be used to get the count of records in a table –

Select * from <tablename> Select count(*) from <tablename> Select rows from sysindexes where id=OBJECT_ID(tablename) and indid<2

Select * from <tablename> Select count(*) from <tablename> Select rows from sysindexes where id=OBJECT_ID(tablename) and indid<2

What is an IDENTITY column in insert statements?

IDENTITY column is used in table columns to make that column as Auto incremental number or a surrogate key.

What is Bulkcopy in SQL?

Bulkcopy is a tool used to copy large amount of data from Tables. This tool is used to load large amount of data in SQL Server.

What will be query used to get the list of triggers in a database?

Query to get the list of triggers in database-

Select * from sys.objects where type=’tr’

Select * from sys.objects where type=’tr’.

What are different backups available in SQL Server?

Different possible backups are:

Full backup
Differential Backup
Transactional Log Backup
Copy Only Backup
File and Filegroup backup

What is a FULL Backup?

A full backup is the most common type of backup in SQL Server. This is the complete backup of the database. It also contains part of transaction log so it can be recovered.

What is OLTP?

OLTP means Online transaction processing which follows rules of data normalization to ensure data integrity. Using these rules complex information is broken down into a most simple structure.

What is RDBMS?

RDBMS or Relational Data Base Management Systems are database management systems that maintain data in the form of tables. We can create relationships between the tables. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage.

What are the properties of the Relational tables?

Relational tables have six properties:

Values are atomic.
Column values are of the same kind.
Each row is unique.
The sequence of columns is insignificant.
The sequence of rows is insignificant.
Each column must have a unique name.

What’s the difference between a primary key and a unique key?

The differences between primary key and a unique key are:

The primary key is a column whose values uniquely identify every row in a table. Primary key values can never be reused. They create a clustered index on the column and cannot be null.
A Unique key is a column whose values also uniquely identify every row in a table but they create a non-clustered index by default and it allows one NULL only.

When is UPDATE_STATISTICS command used?

As the name implies UPDATE_STATISTICS command updated the statistics used by the index to make the search easier.

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?

The differences between HAVING CLAUSE and WHERE CLAUSE are:

Both specify a search condition but Having clause is used only with the SELECT statement and typically used with GROUP BY clause.
If GROUP BY clause is not used then Having behaved like WHERE clause only.

Which TCP/IP port does SQL Server run on?

By default SQL Server runs on port 1433.

What is the difference between clustered and a non-clustered index?

A clustered index is an index that rearranges the table in the order of index itself. Its leaf nodes contain data pages. A table can have only one clustered index.

A non-clustered index is an index that does not re-arranges the table in the order of index itself. Its leaf nodes contain index rows instead of data pages. A table can have many non-clustered indexes.

Post a Comment

Previous Post Next Post