SQL Tutorial
SQL Tutorial
1. What is DBMS?
2. What is RDBMS?
3. What is SQL?
SQL stands for Structured Query Language , and it is used to communicate with the Database.
This is a standard language used to perform tasks such as retrieval, updating, insertion and
deletion of data from a database.
4. What is a Database?
A primary key is a combination of fields which uniquely specify 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.
9. What is a join?
Database Relationship is defined as the connection between the tables in a database. There are
various data basing relationships,
and they are as follows:.
One to One Relationship.
1
Rohan Singh R QUESTIONS SQL
A DB query is a code written in order to get the information back from the database.
Query can be designed in such a way that it matched with our expectation of the result set.
Simply, a question to the Database.
A correlated subquery cannot be considered as independent query, but it can refer the column in
a table listed in the FROM the list of the main query.
A Non-Correlated sub query can be considered as independent query and the output of subquery
are substituted in the main query.
DELETE command is used to remove rows from the table, and WHERE clause can be used for
conditional set of parameters.
Commit and Rollback can be performed after delete statement.
TRUNCATE removes all rows from the table. Truncate operation cannot be rolled back.
Constraint can be used to specify the limit on the data type of table.
Constraint can be specified while creating or altering the table statement. Sample of constraint
are.
NOT NULL.
2
Rohan Singh R QUESTIONS SQL
CHECK.
UNIQUE.
PRIMARY KEY.
FOREIGN KEY.
Data Integrity defines the accuracy and consistency of data 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.
Cross join defines as Cartesian product where number of rows in the first table multiplied by
number of rows in the second table.
UNION operator is used to combine the results of two tables, and it eliminates duplicate rows
from the tables.
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.
TRUNCATE removes all the rows from the table, and it cannot be rolled back.
3
Rohan Singh R QUESTIONS SQL
DROP command removes a table from the database and operation cannot be rolled back.
Aggregate functions are used to evaluate mathematical calculation and return single values.
This can be calculated from the columns in a table.
29. How can you create an empty table from an existing table?
Example will be -.
31. What is the command used to fetch first 5 characters of the string?