Computer Knowledge

Database and SQL

4,213 Questions

Master structured query language commands, database joins, table constraints, and alias generation. This section covers relational database management concepts and query outputs essential for technical aptitude. These technical questions feature prominently in banking IT officer exams and computer knowledge sections.

SQL queries and aliasesDatabase table constraintsDatabase joins and transformationsStored procedures and functions

Database and SQL Questions

Multiple choice
  1. Alter table

  2. Resize

  3. Drop

  4. Change Size

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The alter statement is used to resize a column.  The size of a column can both be increased or decreased using the alter keyword. Normally, the size of a column can be increased to a large value but it can only be decreased to the limit that if there is data present in the column, it should not get trimmed.

Multiple choice
  1. Structured Question Lanaguage

  2. Strurctured Queried Language

  3. Structured Query Language

  4. Structured Queries Language

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

It is the language to handle basic database operations like creating a table and managing it. Some of the keywords of SQL are Create,Select, Delete, Update etc.. SQL is also sometimes called SEQUEL which stands for Simple English Like Query Language. SQL is supported by all the major RDBMS products like Oracle, Ms-SQL Server, MySQL to name a few.

Multiple choice
  1. & and *

  2. % and *

  3. % and _ (underscore)

  4. $ and _ (underscore)
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The Like operator is used for pattern matching in VARCHAR columns. It is useful in conditions where we do not to compare a value exactly with another. For example, if we want to search for all the persons whose names start with  A, we can use the Like operator with the wildcard character. % is used for substituting a string. For conducting a character replacement we can use the _ (underscore) operator. It is used for matching values that are of a particular length.

Multiple choice
  1. Select * from tables

  2. Select * from tab

  3. Select * from tabs

  4. Select all from tab

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The above statement is a valid statement and will display a list of tables available in a user's account. The statement will also print the names of the available view, synonyms etc. The select * from tab statement actually queries a synonym named tab which is in the System user account. All the users created in Oracle have a default access to the synonym. Therefore when we are issuing the above statement we are in fact querying the said synonym.

Multiple choice
  1. Undo

  2. Recover

  3. Rollback

  4. Recall

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Rollback is a part of Transaction Control Language or (TCL). It is used to cancel or undo any changes made in a table. For example, it the user has accidently deleted the data, it can be easily rollbacked to the previous state. The other commands of the same category (TCL) are commit, savepoint etc.

Multiple choice
  1. view

  2. object

  3. synonym

  4. alias

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Alias is the temporary name given to a table or a column. An alias is quite useful where the name of the table is lengthy and the name has to be written more than once in a statement. A table alias is generally a word with one or two letters that can substitute a table name. For example, if the name of a table is sales_1999, then instead of writing sales_1999 everytime it is required, we can create an alias an use it. Consider the following statement: Select s.data from sales_1999 where s.no=101 in the above statement. S is an alias and it is used as a substitution for the word sales_1999.

Multiple choice
  1. deletes all the records from a table

  2. deletes all the rows along with the table

  3. deletes the structure of the table leaving rows intact

  4. deletes only the null rows of a table

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The Truncate Table statement is used to delete all the rows of a table at once. The statement allows the user to delete all the records without specifying a condition using the where clause. Truncate  deletes all the records but keeps the structure of the table intact. The output of this statement is equivalent to the delete statement without the where statement.