Criteria for Comparison WHERE HAVING
Row operations have been implemented.
operations on columns
A single row was used.
The grouped or summary row
Used to retrieve specific data from specified rows based on a criterion.
Getting all of the data and sorting it according to the conditions
Functions that combine
We are unable to have them.
You’re welcome to them.
SELECT, UPDATE, and DELETE are all valid options.
It isn’t possible to use it without a SELECT statement.
clause GROUP BY
This clause follows the WHERE clause.
This clause comes before the HAVING clause.
SQL stands for ‘Structured Query Language,’ and it is a database query language. SQL is the standard query language used by ANSI for maintaining relational database management systems (RDBMS) and conducting various data manipulation operations on various types of data. It is a database language that is used to create and delete databases, as well as to fetch and edit table rows and a variety of other tasks.
The main significant subsets of SQL are:
- DDL(Data Definition Language)
- DML(Data Manipulation Language)
- DCL(Data Control Language)
- TCL(Transaction Control Language)
• Data Definition Language (DDL): DDL is the part of SQL that describes the database’s data structure when it is being built for the first time. It’s mostly used for creating and reorganising database items. The following are DDL commands:
o Make a table o Change a table o Remove a table
• Data Manipulation Language (DML): DML is a programming language that is used to manipulate data in a database. In other words, it aids users in retrieving and manipulating data. It’s used to do things like insert data into the database, update data using the update command, and delete data from the database with the delete command.
• Data Control Language (DCL): DCL is a programming language that is used to control the flow of data.
There are four types of database management systems:
• Hierarchical database: A hierarchical database is a tree-like structure that stores data in a hierarchical way. The parent may have multiple children in this database, but each child should have only one parent.
• Network database: This database is displayed as a graph with many-to-many relationships. Children can have many children in this database.
• Relational database: A table represents a relational database. The values in the columns and rows are interrelated. Because it is simple to use, it is the most extensively used database.
• Object-Oriented Database: This database stores data values and processes as objects. All
The following are the operations that can be carried out using a SQL database:
• establishing new databases
• Adding additional information
• erasing info that already exists
• Maintaining records
• Getting the information
• Adding and removing tables
• Creating views and functions
• Changing data types
A primary key is used to uniquely identify all table records. It cannot have NULL values, and it must contain unique values. A table can have only one primary key that consists of single or multiple fields.
Now, we will write a query for demonstrating the use of a primary key for the Employee table:
//CREATE TABLE Employee (ID int NOT NULL,Employee_name varchar(255) NOT NULL,Employee_designation varchar(255),Employee_Age int,PRIMARY KEY (ID)
The key which can accept only the null value and cannot accept the duplicate values is called Unique Key. The role of the unique key is to make sure that each column and row are unique.
The syntax will be the same as the Primary key. So, the query using a Unique Key for the Employee table will be:
//CREATE TABLE Employee (ID int NOT NULL,Employee_name varchar(255) NOT NULL,Employee_designation varchar(255),Employee_Age int,UNIQUE(ID));
Both the Primary and Unique keys have unique values, but the Primary key cannot be null, but the Unique key can. There can only be one primary key in a table, however there can be several unique keys.
The FLOOR() function is used to discover the biggest integer value of a given number, which can be equal to or less than the supplied number.