0% found this document useful (0 votes)
7 views2 pages

Mysql Notes

A Database Management System (DBMS) is software for managing databases, with examples including MySQL and Oracle. Key concepts include relational databases, data models, SQL, primary keys, foreign keys, and various SQL functions like COUNT, ORDER BY, and GROUP BY. The document also explains the differences between various SQL clauses and functions, including single-row and aggregate functions.

Uploaded by

vijetabhatia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Mysql Notes

A Database Management System (DBMS) is software for managing databases, with examples including MySQL and Oracle. Key concepts include relational databases, data models, SQL, primary keys, foreign keys, and various SQL functions like COUNT, ORDER BY, and GROUP BY. The document also explains the differences between various SQL clauses and functions, including single-row and aggregate functions.

Uploaded by

vijetabhatia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Database Management System (DBMS)

1. What is a DBMS? Name any two examples of DBMS.


A Database Management System (DBMS) is software that manages databases by
providing functionalities like storing, retrieving, and managing data efficiently.
o Example-MySQL, Oracle.
2. What is a relational database?
o A relational database organizes data into tables that are related to each other
using keys.
3. What is a Data Model?
o A Data Model is an abstract model that organizes elements of data and
standardizes how they relate to one another. Example- Relational Data Model,
Hierarchical Data Model.
4. What does RDBMS stand for?-Relational Database Management System.
5. What is SQL?
SQL stands for Structured Query Language, which is used to interact with databases.
6. Define Primary Key.
A Primary Key is a column or a combination of columns that uniquely identifies a
record in a table.
7. What is a Candidate Key?
A Candidate Key is any column or combination of columns that can act as a primary
key.
8. Explain the term Foreign Key.
A Foreign Key is a column that establishes a relationship between two tables,
referring to the Primary Key of another table.
9. If a table has 5 columns and 4 rows, what is its degree and cardinality?

 Degree refers to the number of columns (attributes) in a table.

 Cardinality refers to the number of rows (records) in a table.

Degree = 5, Cardinality = 4.

10. What is the default sorting order when using ORDER BY?
The default sorting order is ascending.
11. What is the purpose of the GROUP BY clause in SQL?
The GROUP BY clause is used to group rows that have the same values in specified
columns and apply aggregate functions like SUM(), COUNT(), AVG(), etc., on the
grouped data.
12. What is the primary difference between COUNT(*) and COUNT(column) in SQL?
COUNT(*) counts all rows, including NULL values, while COUNT(column) ignores
NULL values.
13. Difference between ORDER BY and GROUP BY in SQL:
o ORDER BY is used to sort the result set in ascending (ASC) or descending
(DESC) order.GROUP BY is used to group rows that have the same values in
specified columns, often for aggregate calculations.
o ORDER BY is typically used to arrange the output for better readability.
GROUP BY is commonly used with aggregate functions like SUM(), COUNT(),
AVG(), MAX(), or MIN().
14. Can GROUP BY be used without aggregate functions? Justify your answer.
 No, GROUP BY is generally used with aggregate functions. Without aggregate
functions, it is ineffective since its purpose is to summarize data.
15. What is the difference between WHERE and HAVING clauses?
 WHERE is used to filter rows before grouping, while HAVING is used to filter grouped
data after applying aggregate functions.
16. What is an equi-join in SQL?
 An equi-join is a type of join that combines rows from two or more tables based on
matching column values, typically using the = operator.

17. Write an SQL query using an equi-join to display employee names and their
department names from Employee and Department tables.

SELECT Employee.EmpName, Department.DeptName


FROM Employee
INNER JOIN Department
ON Employee.DeptID = Department.DeptID;
18. What are the necessary conditions to perform an equi-join between two tables?
 The tables must have at least one common column with matching values, typically a
primary and foreign key relationship.If two tables have no matching records for an
equi-join, The result will be an empty set with no rows displayed.
19. What is the difference betwween single row and aggregate functions with example
in 2lines

Single-row functions operate on each row individually and return one result
per row (e.g., UPPER(), LENGTH()).

Aggregate functions perform calculations on a set of rows and return a single


result (e.g., SUM(), AVG()).

You might also like