SELECT Statement & COUNT Function in SQL | SQL Queries / Coding
This query will fetch all columns and all records(rows) from the "Employees"
table, providing a complete result set of all employee data stored in the table.
The COUNT(*) function is an aggregate function that returns the total number of rows in a result set.
The asterisk (*) in the SELECT statement
is a shorthand notation to select all
columns.
Table Details:
Consider a Employees data set contains following tables:
Departments - dept_no, dept_name
Dep_emp - emp_no, dept_no, from_date, to_date
Dep_manager - emp_no, dept_no, from_date, to_date
Employees - emp_no, birth_date, first_name, last_name, gender, hire_date
Salaries - emp_no, salary, from_date, to_date
Titles - emp_no, titles, from_date, to_date
What are the subsets of SQL
The SQL commands are mainly divided into four categories as:
DDL – Data Definition Language
DML – Data Manipulation Language
DCL – Data Control Language
TCL – Transaction Control Language
Data Definition Language: Used to create, modify & delete database objects such as tables, views, indexes & constraints.
Data Manipulation Language: Used to SELECT, insert, update, delete & retrieve data from a database table.
Data Control Language. Used to manage access control and security of a data base. Commands like GRANT, REVOKE.
Transaction Control Language. Used to manage transactions in a data base. Commands like COMMIT, ROLL BACK.
These subsets of SQL allow users to perform different types of operations on a database and provide a powerful set of tools for managing and manipulating data.
#sql #sqltutorial #sqlqueries #sqlcourse