1. What is difference between SQL and MySQL?
1. What is difference between SQL and MySQL?
Another you may add that SQL is product of Microsoft and MySQL is Product of Oracle.
2. What are the different subset in SQL?
- DQL(Data Query Language)
- DDL(Data Definition Language)
- DML(Data Manipulation Language). Allow to access and manipulate data.
- DCL(Data Control Language). Allows control access to database.
- TCL(Transaction Control Language)
3. What are DBMS and what are its types?
Database Management System (DBMS) is a software for storing and retrieving users’ data while considering appropriate security measures. It consists of a group of programs which manipulate the database. The DBMS accepts the request for data from an application and instructs the operating system to provide the specific data. In large systems, a DBMS helps users and other third-party software to store and retrieve data.
The main Four Types of Database Management System are:
- Hierarchical database
- Network database
- Relational database
- Object-Oriented database
for more information on Database please refer to https://www.guru99.com/what-is-dbms.html
4. What is Tables & Fields in SQL?
Tables contain rows and columns, where the rows are known as records and the columns are known as fields. A column is a set of data values of a particular type (like numbers or alphabets), one value for each row of the database, for example, Age, Student_ID, or Student_Name.
5.What are Joins in SQL?
A join clause in SQL – corresponding to a join operation in relational algebra – combines columns from one or more tables into a new table. ANSI-standard SQL specifies five types of JOIN: INNER, LEFT OUTER, RIGHT OUTER, FULL OUTER and CROSS.
6. What are data types in SQL?
The data type of a column defines what value the column can hold: integer, character, money, date and time, binary, and so on
for more information visit SQL Data Type.
7. What is Primary key and Foreign key?
Primary Key:
A primary key is used to ensure data in the specific column is unique. It is a column cannot have NULL values. It is either an existing table column or a column that is specifically generated by the database according to a defined sequence.
Example: Refer the figure –
STUD_NO, as well as STUD_PHONE both, are candidate keys for relation STUDENT but STUD_NO can be chosen as the primary key (only one out of many candidate keys).
Foreign Key:
A foreign key is a column or group of columns in a relational database table that provides a link between data in two tables. It is a column (or columns) that references a column (most often the primary key) of another table.
Example: Refer the figure –
STUD_NO in STUDENT_COURSE is a foreign key to STUD_NO in STUDENT relation.
SQL constraints are used to specify rules for the data in a table.
Constraints are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the table. If there is any violation between the constraint and the data action, the action is aborted.
Constraints can be column level or table level. Column level constraints apply to a column, and table level constraints apply to the whole table.
The following constraints are commonly used in SQL:
NOT NULL - Ensures that a column cannot have a NULL value
UNIQUE - Ensures that all values in a column are different
PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table
FOREIGN KEY - Prevents actions that would destroy links between tables
CHECK - Ensures that the values in a column satisfies a specific condition
DEFAULT - Sets a default value for a column if no value is specified
CREATE INDEX - Used to create and retrieve data from the database very quickly.
9. What are the differences between Delete and Truncate statement?
A unique key is a set of one or more than one fields/columns of a table that uniquely identify a record in a database table. You can say that it is little like primary key but it can accept only one null value and it cannot have duplicate values. There is an automatically defined unique key constraint within a primary key constraint. There may be many unique key constraints for one table, but only one PRIMARY KEY constraint for one table.
0 comments:
Post a Comment