







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








What is a DBMS? - Answer A Database Management System (DBMS) is a program thatcontrols creation, maintenance and use of a database. DBMS can be termed as File Manager that manages data in a database rather than saving it in file systems What is RDBMS? - Answer RDBMS stands for Relational Database Management System.RDBMS store the data into the collection of tables, which is related by common fields between the columns of the table. It also provides relational operators to manipulate thedata stored into the tables. Example: SQL Server. What is SQL? - Answer SQL stands for Structured Query Language , and it is used tocommunicate with the Database. This is a standard language used to perform tasks such as retrieval, updation, insertion and deletion of data from a database. Standard SQL Commands are Select. What is a Database? - Answer an organized form of data for easy access, storing,retrieval and managing of data. This is also known as structured form of data which can be accessed in many ways. Example: School Management Database, Bank Management Database. What are tables and Fields? - Answer A table is a set of data that are organized in a modelwith Columns and Rows. Columns can be categorized as vertical, and Rows are horizontal. A table has specified number of column called fields but can have any numberof rows which is called record.
Example:.
Table: Employee. Field: Emp ID, Emp Name, Date of Birth. Data: 201456, David, 11/15/1960. What is a primary key? - Answer A primary key is a combination of fields which uniquelyspecify a row. This is a special kind of unique key, and it has implicit NOT NULL constraint. It means, Primary key values cannot be NULL. What is a unique key? - Answer A Unique key constraint uniquely identified each recordin the database. This provides uniqueness for the column or set of columns.
A Primary key constraint has automatic unique constraint defined on it. But not, in thecase of Unique Key.
There can be many unique constraint defined per table, but only one Primary keyconstraint defined per table.
What is a foreign key? - Answer A foreign key is one table which can be related to theprimary key of another table. Relationship needs to be created between two tables by referencing foreign key with the primary key of another table. What is a join? - Answer 'join' used to connect two or more tables logically with orwithout common field(s)
What are the types of join and explain each? - Answer various types of join which can beused to retrieve data and it depends on the relationship between tables.
Inner Join.
Second Normal Form (2NF):. Meeting all requirements of the first normal form. Placing the subsets of data in separatetables and Creation of relationships between the tables using primary keys.
Third Normal Form (3NF):.This should meet all requirements of 2NF. Removing the columns which are not dependent on primary key constraints. Fourth Normal Form (3NF):.Meeting all the requirements of third normal form and it should not have multi- valued dependencies. What is a View? - Answer A view is a virtual table which consists of a subset of datacontained in a table. Views are not virtually present, and it takes less space to store. View can have data of one or more tables combined, and it is depending on the relationship. What is an Index? - Answer An index is performance tuning method of allowing fasterretrieval of records from the table. An index creates an entry for each value and it will be faster to retrieve data. What are all the different types of indexes? - Answer There are three types of indexes: Unique Index.This indexing does not allow the field to have duplicate values if the column is unique indexed. Unique index can be applied automatically when primary key is defined. Clustered Index.This type of index reorders the physical order of the table and search based on the key values. Each table can have only one clustered index.
NonClustered Index.NonClustered Index does not alter the physical order of the table and maintains logical order of data. Each table can have 999 nonclustered indexes. What is a Cursor? - Answer A database Cursor is a control which enables traversal overthe rows or records in the table. This can be viewed as a pointer to one row in a set of rows. Cursor is very much useful for traversing such as retrieval, addition and removal ofdatabase records.
What is a relationship and what are they? - Answer Database Relationship is defined asthe connection between the tables in a database. There are various data basing relationships, and they are as follows:. One to One Relationship. One to Many Relationship. Many to One Relationship. Self-Referencing Relationship. What is a query? - Answer A command to retrieve data from tables/ question to thedatabase
What is a subquery? - Answer A query inside another query. The outer query is called asmain query, and inner query is called subquery. SubQuery is always executed first, and the result of subquery is passed on to the main query. What are the types of subquery? - Answer two types of subquery - Correlated andNon-Correlated.
What is a constraint? - Answer Constraint can be used to specify the limit on the datatype of table. Constraint can be specified while creating or altering the table statement. Sample of constraint are. NOT NULL. CHECK.DEFAULT. UNIQUE.PRIMARY KEY. FOREIGN KEY. What is data integrity? - Answer Data Integrity defines the accuracy and consistency ofdata stored in a database. It can also define integrity constraints to enforce business rules on the data when it is entered into the application or database. What is Auto Increment? - Answer Auto increment keyword allows the user to create aunique number to be generated when a new record is inserted into the table. AUTO INCREMENT keyword can be used in Oracle and IDENTITY keyword can be used in SQLSERVER.
Mostly this keyword can be used whenever PRIMARY KEY is used. What is the difference between Cluster and Non-Cluster Index? - Answer Clustered indexis used for easy retrieval of data from the database by altering the way that the records are stored. Database sorts out rows by the column which is set to be clustered index. A nonclustered index does not alter the way it was stored but creates a completeseparate object within the table. It point back to the original table rows after searching.
What is a datawarehouse? - Answer Datawarehouse is a central repository of data frommultiple sources of information. Those data are consolidated, transformed and made available for the mining and online processing. Warehouse data have a subset of data
called Data Marts. What is Self-Join? - Answer Self-join is set to be query used to compare to itself. This isused to compare values in a column with other values in the same column in the same table. ALIAS ES can be used for the same table comparison. What is Cross-Join? - Answer Cross join defines as Cartesian product where number ofrows in the first table multiplied by number of rows in the second table. If suppose, WHERE clause is used in cross join then the query will work like an INNER JOIN. What is user defined functions? - Answer User defined functions are the functions writtento use that logic whenever required. It is not necessary to write the same logic several times. Instead, function can be called or executed whenever needed. What are all types of user defined functions? - Answer Three types of user definedfunctions are.
Scalar Functions. Inline Table valued functions.Multi statement valued functions. Scalar returns unit, variant defined the return clause. Other two types return table as areturn.
What is collation? - Answer Collation is defined as set of rules that determine howcharacter data can be sorted and compared. This can be used to compare A and, other language characters and also depends on the width of the characters. ASCII value can be used to compare these character data. What are all different types of collation sensitivity? - Answer Case Sensitivity - A and aand B and b. Accent Sensitivity.
MINUS operator is used to return rows from the first query but not from the second query.Matching records of first and second query and other rows from the first query will be displayed as a result set. INTERSECT operator is used to return rows returned by both the queries. What is an ALIAS command? - Answer ALIAS name can be given to a table or column.This alias name can be referred in WHERE clause to identify the table or column.
Example-. Select st.StudentID, Ex.Result from student st, Exam as Ex where st.studentID = Ex.StudentID Here, st refers to alias name for student table and Ex refers to alias name for exam table. What is the difference between TRUNCATE and DROP statements? - Answer TRUNCATEremoves all the rows from the table, and it cannot be rolled back. DROP command removes a table from the database and operation cannot be rolled back. What are aggregate and scalar functions? - Answer Aggregate functions are used toevaluate mathematical calculation and return single values. This can be calculated from the columns in a table. Scalar functions return a single value based on the input value. Example -. Aggregate - max(), count - Calculated with respect to numeric. Scalar - UCASE(), NOW() - Calculated with respect to strings. How can you create an empty table from an existing table? - Answer Select * intostudentcopy from student where 1=
Here, we are copying student table to another table with the same structure with no rowscopied.
How to fetch common records from two tables? - Answer Select studentID from student.INTERSECT Select StudentID from Exam
How to fetch alternate records from a table? - Answer Records can be fetched for bothOdd and Even row numbers -.
To display even numbers-. Select studentId from (Select rowno, studentId from student) where mod(rowno,2)= To display odd numbers-. Select studentId from (Select rowno, studentId from student) where mod(rowno,2)= from (Select rowno, studentId from student) where mod(rowno,2)=1.[/sql] How to select unique records from a table? - Answer Select unique records from a tableby using DISTINCT keyword.
Select DISTINCT StudentID, StudentName from Student. What is the command used to fetch first 5 characters of the string? - Answer SelectSUBSTRING(StudentName,1,5) as studentname from student
Select RIGHT(Studentname,5) as studentname from student Which operator is used in query for pattern matching? - Answer LIKE operator is used for
IF StatementPIvot table