Database Developer

  Home  Databases Programming  Database Developer


“Database Developer Frequently Asked Questions in various Database Developer job interviews by interviewer. The set of questions are here to ensures that you offer a perfect answer posed to you. So get preparation for your new job interview”



70 Database Developer Questions And Answers

41⟩ Explain me how are transactions used?

Transactions allow you to group SQL commands into a single unit. The transaction begins with a certain task and ends when all tasks within it are complete. The transaction completes successfully only if all commands within it complete successfully. The whole thing fails if one command fails. The BEGIN TRANSACTION, ROLLBACK TRANSACTION, and COMMIT TRANSACTION statements are used to work with transactions. A group of tasks starts with the begin statement. If any problems occur, the rollback command is executed to abort. If everything goes well, all commands are permanently executed via the commit statement.

 189 views

45⟩ Tell us what are the different types of SQL commands?

SQL commands are segregated into following types:

☛ DDL – Data Definition Language

☛ DML – Data Manipulation Language

☛ DQL – Data Query Language

☛ DCL – Data Control Language

☛ TCL – Transaction Control Language

 187 views

46⟩ Tell me why DBAs don’t like cursors?

I like to phrase this interview question this way because I’m not saying the DBA is right – I’m just asking the developer to explain the DBA’s point of view. I don’t have a problem with the developer rolling their eyes as they explain the answer, but I have a problem with the developer being surprised by the question.

The candidate gets bonus points if they seem even vaguely aware of the terms “set-based processing” and “row-based processing”, but that’s purely a bonus. (I wish I could say that these concepts are requirements, but in today’s economic market, companies don’t always want to pay top dollar to get the best candidates.)

 187 views

47⟩ Explain me what is the difference between Union and Union All command?

This is one of the tricky SQL Interview Questions. Interviewer may ask you this question in another way as what are the advantages of Union All over Union.

Both Union and Union All concatenate the result of two tables but the way these two queries handle duplicates are different.

Union: It omits duplicate records and returns only distinct result set of two or more select statements.

Union All: It returns all the rows including duplicates in the result set of different select statements.

Performance wise Union All is faster than Union, Since Union All doesn’t remove duplicates. Union query checks the duplicate values which consumes some time to remove the duplicate records.

Assume: Table1 has 10 records, Table2 has 10 records. Last record from both the tables are same.

If you run Union query.

SELECT * FROM Table1

UNION

SELECT * FROM Table2

Output: Total 19 records

If you run Union query.

SELECT * FROM Table1

UNION ALL

SELECT * FROM Table2

Output: Total 20 records

Data type of all the columns in the two tables should be same.

 194 views

48⟩ Explain me what is a Primary Key?

A PRIMARY KEY constraint uniquely identifies each record in a database table. All columns participating in a primary key constraint must not contain NULL values.

 197 views

49⟩ Tell us what is a Trigger?

A Trigger is a SQL procedure that initiates an action in response to an event (Insert, Delete or Update) occurs. When a new Employee is added to an Employee_Details table, new records will be created in the relevant tables such as Employee_Payroll, Employee_Time_Sheet etc.,

 183 views

51⟩ Tell me referential integrity and where it can be enforced?

If they stumble on the question, circle back to the Orders and OrderDetails tables we used as examples earlier. What’s an orphan? How do we make sure that we don’t end up with OrderDetails for records with no matching Order record? Where are all the places we could enforce referential integrity? (Think foreign keys, triggers, the application, or not at all.) Have you worked in places where there was no referential integrity, and what problems did you run into?

 197 views

52⟩ Tell us what is SQL?

SQL Overview: SQL stands for Structured Query Language. It is an American National Standard Institute (ANSI) standard. It is a standard language for accessing and manipulating databases. Using SQL, some of the action we could do are to create databases, tables, stored procedures (SP’s), execute queries, retrieve, insert, update, delete data against a database.

 198 views

53⟩ Tell me what are Operators available in SQL?

SQL Operator is a reserved word used primarily in an SQL statement’s WHERE clause to perform operations, such as arithmetic operations and comparisons. These are used to specify conditions in an SQL statement.

There are three types of Operators.

☛ Arithmetic Operators

☛ Comparison Operators

☛ Logical Operators

 195 views

55⟩ Tell me what are DMVs?

Dynamic management views (DMVs) and functions return server state information that can be used to monitor the health of a server instance, diagnose problems, and tune performance; that is, they let you see what is going on inside SQL Server. They were introduced in SQL Server 2005 as an alternative to system tables. One example is viewing operating system wait statistics via this query:

SELECT * FROM sys.dm_os_wait_stats;

Another example is examining current sessions, much like the sp_who2 command:

SELECT * FROM sys.dm_exec_sessions;

 191 views

56⟩ What are the steps needed to Create the scheduled job?

Steps to create a Scheduled Job :

☛ Connect to the database of SQL server in SQL Server Management Studio. On the SQL Server Agent, we will find a Jobs folder.

☛ Right click on jobs and choose Add New.

☛ A New Job window will come into view. Give an associated name for the same.

☛ Click next on the “Steps” in the left list of options. An SQL job can have multiple steps either in the form of SQL declaration or a stored practice call.

☛ Click on the “Schedules” in the left list of options. An SQL job can comprise of one or supplementary schedules. It is basically the instance at which SQL job will jog itself. We can spell out returning schedules also.

 192 views

58⟩ Please explain what are string functions in SQL?

SQL string functions are used primarily for string manipulation. Some of the widely used SQL string functions are

☛ LEN() – It returns the length of the value in a text field

☛ LOWER() – It converts character data to lower case

☛ UPPER() – It converts character data to upper case

☛ SUBSTRING() – It extracts characters from a text field

☛ LTRIM() – It is to remove all whitespace from the beginning of the string

☛ RTRIM() – It is to remove all whitespace at the end of the string

☛ CONCAT() – Concatenate function combines multiple character strings together

☛ REPLACE() – To update the content of a string.

 205 views

60⟩ Explain me what is Stored procedure?

A Stored Procedure is a collection of SQL statements that have been created and stored in the database to perform a particular task. The stored procedure accepts input parameters and processes them and returns a single value such as a number or text value or a result set (set of rows).

 206 views