SQL Server 2005 -Interview Questions for Biginners

• If I want to see what fields a table is made of, and what the sizes of the
fields are, what option  do I have to look for?
• What is a query?
• A SQL query is typed in the _________ .
• What is the purpose of the model database?
• What is the purpose of the master database?
• What is the purpose of the tempdb database?
• What is the purpose of the USE command?
• If you delete a table in the database, will the data in the table be deleted too?
• What is the Parse Query button used for? How does this help you?
• Tables are created in a ____________________ in SQL Server 2005.
• What is usually the first word in a SQL query?
• Does a SQL Server 2005 SELECT statement require a FROM?
• Can a SELECT statement in SQL Server 2005 be used to make an assignment?
Explain with examples.
• What is the ORDER BY used for?
• Does ORDER BY actually change the order of the data in the tables or does it just
change the output?
• What is the default order of an ORDER BY clause?
• What kind of comparison operators can be used in a WHERE clause?
• What are four major operators that can be used to combine conditions on a WHERE
clause? Explain the operators with examples.
• What are the logical operators?
• In a WHERE clause, do you need to enclose a text column in quotes? Do you need to
enclose a numeric column in quotes?
• Is a null value equal to anything? Can a space in a column be considered a null
value? Why or why not?
• Will COUNT(column) include columns with null values in its count?
• What are column aliases? Why would you want to use column aliases? How can you
embed blanks in column aliases?
• What are table aliases?
• What are table qualifiers? When should table qualifiers be used?
• Are semicolons required at the end of SQL statements in SQL Server 2005?
• Do comments need to go in a special place in SQL Server 2005?
• When would you use the ROWCOUNT function versus using the WHERE clause?
• Is SQL case-sensitive? Is SQL Server 2005 case-sensitive?
• What is a synonym? Why would you want to create a synonym?
• Can a synonym name of a table be used instead of a table name in a SELECT
statement?
• Can a synonym of a table be used when you are trying to alter the definition
of a table?
• Can you type more than one query in the query editor screen at the same time?
• The INSERT INTO .. VALUES option will insert rows into the _________ of a table.
• While you are inserting values into a table with the INSERT INTO .. VALUES
option, does the order of the columns in the INSERT statement have to be the
same as the order of the columns in the table?
• While you are inserting values into a table with the INSERT INTO .. SELECT
option, does the  order of the columns in the INSERT statement have to be
the same as the order of the columns in the table?
• When would you use an INSERT INTO .. SELECT option versus an INSERT INTO .. VALUES   option? Give an example of each.
• What does the UPDATE command do?
• Can you change the data type of a column in a table after the table has been
created? If so,which command would you use?
• Will SQL Server 2005 allow you to reduce the size of a column?
• What integer data types are available in SQL Server 2005?
• What is the default value of an integer data type in SQL Server 2005?
• What decimal data types are available in SQL Server 2005?
• What is the difference between a CHAR and a VARCHAR datatype?
• Does Server SQL treat CHAR as a variable-length or fixed-length column?
Do other SQL implementations treat it in the same way?
• If you are going to have too many nulls in a column, what would be the best
data type to use?
• When columns are added to existing tables, what do they initially contain?
• What command would you use to add a column to a table in SQL Server?
• In SQL Server, which data type is used to store large object data types?
• If I do not need to store decimal places, what would be a good numeric data
type to use?
• I I need to store decimal places, but am not worried about rounding errors,
what would be a    good  data type to use?
• Should a column be defined as a FLOAT if it is going to be used as a primary key?
• What is a join? Why do you need a join?
• What is an INNER JOIN?
• Which clause[s] can be used in place of the JOIN in Server SQL?
• What is the Cartesian product?
• What would be the Cartesian product of a table with 15 rows and another table
with 23 rows?
• List some uses of the Cartesian product.
• What is an equi-join?
• What is a non-equi-join? Give an example of an non-equi-join.
• What is a self join? Give an example of a self join.
• What is a LEFT OUTER JOIN?
• What is a RIGHT OUTER JOIN?
• What is a CROSS JOIN?
• What is a FULL OUTER JOIN?


• Does Server SQL allow the use of *= to perform outer joins?
• What is the maximum number of rows that a self join can produce?
• For what kinds of joins will the associative property hold?
• What would be the Cartesian product of the two sets {a,b,c} and {c,d,e}?
• What are functions?
• What are aggregate functions? Give examples of aggregate functions.
What is another term for   an aggregate function?
• What are row-level functions? Give examples of row-level functions.
• Is COUNT an aggregate function or a row-level function? Explain why.
Give at least one   example of when the COUNT function may come in handy.
Does the COUNT function take nulls into account?
• Is AVG an aggregate function or a row-level function?
• What is the NULLIF function? Explain.
• How are ties handled in SQL Server?
• How does the DISTINCT function work?
• Are string functions (for example, SUBSTRING, RIGHT, LTRIM) aggregate
functions or row- level functions?
• What is the SUBSTRING function used for?
• What is the CHARINDEX function used for?
• What function would you use to find the leftmost characters in a string?
• What are the LTRIM/RTRIM functions used for?
• What function would produce the output in all lowercase?
• What function would you use to find the length of a string?
• What characters or symbols are most commonly used as wildcard characters in
SQL Server 2005?
• What is the concatenation operator in Server SQL 2005?
• What does the YEAR function do?
• What does the MONTH function do?
• What does the GEtdATE function do?
• What will the following query produce in SQL Server 2005?
o SELECT ('.....'+ names) AS [names]
o FROM Employee

• Does Server SQL allow an expression like COUNT(DISTINCT column_name)?
• How is the ISNULL function different from the NULLIF function?
• What function would you use to round a value to three decimal places?
• Which functions can the WITH TIES option be used with?
• What clause does the WITH TIES option require?
• What is the default date format in SQL Server 2005?
• How do dates have to be entered in Server SQL 2005?
• What function is used to convert between data types?
• What function is useful for formatting numbers?
• What function is useful for formatting dates?
• Which has precedence, AND or OR?
• Why do we need derived structures?
• What is a view?
• List some advantages of using views.
• List some advantages of using temporary tables.
• Can temporary tables replace views in all cases?
• What is the difference between a view and temporary table?
• What is the difference between a local temporary table and global temporary table?
• If data is changed in a view, is it changed in the original table?
• If data is changed in a temporary table, does it automatically change data in
the original table?
• What happens to local temporary tables after the session has been ended?
• What happens to global temporary table after the session has been ended?
• Which type of temporary table has a system-generated suffix attached to it?
What does this    suffix mean?
• Why are inline views helpful?
• In SQL Server, is the ORDER BY clause allowed during the creation of a view?
• Is SELECT INTO allowed in a view? Why or why not?
• Where is the data stored in a view?
• How do you delete views?
• How do you delete a temporary table?
• Do you need to delete a local temporary table? Why or why not?
• Which operators have the highest/lowest precedence?
• In SQL Server, if a column of FLOAT data type were divided by a column of REAL
data type,what data type would the resulting column have? (Hint: refer to the
section on Data Type    Preference.)
• Is an ORDER BY clause necessary when you use a DISTINCT? Why or why not?
• What are the major differences between the UNION operation and the JOIN operation?
• What is the major difference between the UNION and the UNION ALL?
• What major set operator does SQL Server 2005 not have? How can these problems
be resolved?
• What does union compatibility mean?
• What data types are union-compatible?
• What is the maximum number of rows that can result from a UNION of two tablesone
with 5 rows and the other with 6 rows?
• How can a UNION be used to implement an outer join? Explain.
• Does SQL Server 2005 support the MINUS operation? How can this be resolved? Give    examples.
• What is a full outer join? Does SQL Server 2005 directly support a full outer join?
• Do you need the same number of columns to perform a union?
• Do you need the same data types to perform a union?
• Do you need the same number of columns to perform a join?
• From the examples given in the chapter, what does the UNION JOIN appear to do?
• If a VARCHAR column were unioned with a CHAR column, what would the resulting
column be?
• What does set compatibility mean?
• What is the maximum number of rows that can result from a INTERSECT of two
tablesone with 5 rows and the other with 6 rows?
• Do you need the same number of columns to perform an INTERSECT operation?
• Do you need the same data types to perform an INTERSECT operation?
• What is a subquery?
• Which part of the query/subquery is considered the inner query, and which part
is considered the  outer query?
• Can a subquery always be done as a join? Why or why not?
• When writing a query that will have a subquery, how do you determine which
table/tables will go in the outer query?
• Which predicate can usually be reformulated into a join?
• When using operators, are many values acceptable from a result of a subquery?
• What can you do to insure a working subquery?
• What do aggregate functions do?
• How does the GROUP BY clause work?
• What is the difference between a GROUP BY and ORDER BY?
• What is the HAVING clause used for?
• Can the WHERE clause always be considered a substitute for the HAVING clause? Why or why    not?
• Do functions of functions have to be handled in a special way in Server SQL 2005?
• Will nulls in grouped columns be included in a result set?
• How do aggregate functions treat nulls?
• Does the sequence of the columns in a GROUP BY clause have an effect on the end result?
• When would it not make sense to use the GROUP BY and DISTINCT functions together?
• Is GROUP BY affected by nulls?
• Which comes first in a SELECT statement, an ORDER BY or GROUP BY? Why?
• The GROUP BY and ________________ clauses are used together.
• What is a noncorrelated subquery?
• Which type of subquery can be executed on its own?
• Which part of a query is evaluated first, the query or the subquery?
• What are correlated subqueries?
• What does the EXISTS predicate do?
• What are considered universal qualifiers?
• Is correlation necessary when we use EXISTS? Why?
• Explain how the "for all" type SQL query involves a double-nested correlated subquery using    the NOT EXISTS predicate.
• What is an index?
• Does an index slow down updates on indexed columns?
• What is a constraint?
• How many indexes does SQL Server 2005 allow you to have on a table?
• What command would you use to create an index?
• Is there a difference between an index and a constraint?
• What is the default ordering that will be created by an index (ascending or descending)?
• When can the UNIQUE option be used?
• What does the IGNORE NULL option do?
• How do you delete an index?
• What does the NOT NULL constraint do?
• What command must you use to include the NOT NULL constraint after a table has already    been created?
• When a PRIMARY KEY constraint is included in a table, what other constraints does this    imply?
• What is a concatenated primary key?
• How are the UNIQUE and PRIMARY KEY constraints different?
• What is a referential integrity constraint? What two keys does the referential integrity     constraint usually include?
• What is a foreign key?
• What does the ON DELETE CASCADE option do?
• What does the ON UPDATE NO ACTION do?
• Can you use the ON DELETE and ON UPDATE in the same constraint?

1 comment:

  1. Hi

    I like this post very much. It help me to solve some my work under my director’s requirements.

    Apart from that, below article also is the same meaning

    situational interview questions

    Tks again and nice keep posting
    Rgs

    ReplyDelete