SQL Flashcards
How would you rate yourself in SQL?
1-4: Beginner
5-6: Intermediate
6+: Advanced
Answer 1: From the SDET point of view I would consider my SQL skills to be at an 8 out of 10.
Answer 2: I would rate myself 6 out 10 since I am not a database administrator but can perform the necessary queries as an SDET.
What is a Database?
A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS).
What is RDBMS? How is it different from DBMS?
DBMS stands for Database Management System, and RDBMS is the acronym for the Relational Database Management system. In DBMS, the data is stored as a file, whereas in RDBMS, data is stored in the form of tables.
What does SQL stand for?
SQL ⇒ Structured Query Language.
What does Relational mean when we are referring to Relational Database?
Relational Databases are structured with tables connected through Primary and foreign key relationships.
Are you familiar with any constraints in SQL?
Constraint ⇒ Rules for relational databases.
Primary Key ⇒ A unique identifier in a table that helps identify a specific row for a given table.
Uniquely identifies a record in the table.
Foreign Key ⇒ A foreign is a column within a table that is a primary key in another table.
Unique/composite Key ⇒ A column in a table that is not the primary key but only has unique values.
NOT NULL ⇒ There should always be a value defined.
What tools are you using to work with your database?
Currently in my company the application database is a MySQL based server.
I use MySQL workbench to connect to my application database and run queries.
DB Viewer ⇒ MySQL workbench
DB server ⇒ MySQL
What is a Primary Key?
Primary Key ⇒ A unique identifier in a table that helps identify a specific row for a given table.
What is a Foreign Key?
Foreign Key ⇒ A foreign is a column within a table that is a primary key in another table.
What is a UNIQUE key?
Unique/composite Key ⇒ A column in a table that is not the primary key but only has unique values.
What is a Join? What are the different types?
What is a Join? ⇒ The process of combining data between 2 or more tables.
INNER
LEFT
RIGHT
FULL
SELF
Have you heard of an index before?
Indexes are special items added to database tables to allow faster retrieval of data.
What is a subquery?
A query within a query.
Example:
When you need another query to filter a specific value that becomes an input to your main query.
SELECT *
FROM table where column = (Inner query);
Need to find the employees that make more than the average salary?
Select employee_name, phone, email
From employees
Where avg salary > (SELECT avg salary from employees);
What is UNION? What is the difference between UNION and UNION ALL?
UNION ⇒ When you combine the output between multiple independent select statements. (removes duplicate)
UNION ⇒ When you combine the output between multiple independent select statements. (removes duplicate)
UNION ALL => (output will be duplicates and non duplicates)
Rules:
1. Same number of columns in each query.
2. Order of the column and data type needs to match.