SQL /MySQL Flashcards
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, updation, insertion, and deletion of data from a database.
What is RDBMS?
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 the data store into the tables.
What is DBMS?
A Database Management System (DBMS) is a program that controls 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 a primary key?
A combination of fields which uniquely specify a row. This is a special kind of unique key and it has an implicit NOT NULL constraint. Primary key values cannot be NULL.
What is a Database?
An organized form of data for easy access, storing, retrieval, and managing of data. A structured form of data which can be accessed in many ways.
What are tables and fields?
A table is a set of data that are organized in a model with Columns and Rows. Columns are vertical and Rows are horizontal. A table has a specified number of columns called fields but can have any number of rows which are called a record.
What is a unique key?
A unique key constraint uniquely identifies each record in the database. This provides uniqueness for the column or set of columns.
A Primary key constraint has automatic unique constraint defined on it.
There can be many unique constraint defined per table, but only one Primary key constraint defined per table.
What is a foreign key?
A foreign key in one table which can be related to the primary 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?
This is a keyword used to query data from more tables based on the relationship between the fields of the tables. Keys play a major role when JOINs are used.
What is an Inner Join?
An inner join returns rows when there is at least one match of rows between the tables.
What is a Right Join?
Right join returns rows which are common between the tables and all rows of Right hand side table. It returns all the rows from the right hand side table even though there are no matches in the left hand side table.
What is a Left Join?
Left join returns rows which are common between the tables and all rows of Left hand side table. it returns all the rows from Left hand side table even though there are no matches in the Right hand side table.
What is a Full Join?
Full join returns rows when there are matching rows in any one of the tables. It returns all the rows from the left hand side table and all the rows from the right hand side table.
What is a relationship and what are they?
Database Relationships is defined as the connection between the tables in a database. The various data basing relationships are:
- One to One Relationship
- One to Many Relationship
- Many to One Relationship
- Self-Referencing Relationship
What is a Query?
A Query is a question to the database. A DB query is code written in order to get information back from the database.
What is a stored procedure?
Stored Procedure is a function that consists of many SQL statements to access the database system. Several SQL statements are consolidated into a stored procedure that can be executed at any time whenever required.
What is a constraint?
Constraint can be used to specificy the limit on the data type of the table. Constraint can be specified while creating or altering the table statement. Sample of constraints include:
- NOT NULL
- CHECK
- DEFAULT
- UNIQUE
- PRIMARY KEY
- FOREIGN KEY
What is Auto Increment?
Auto Increment keyword allows the user to create a unique number to be generated when a new record is inserted into the table. AUTO INCREMENT keyword can be used whenever PRIMARY KEY is used.