Mauli DBMS Micropro
Mauli DBMS Micropro
Mauli DBMS Micropro
Brief Description:-
SQL (Structured Query Language) operators are essential components used in
database management systems to perform various operations on data. They
allow users to manipulate and retrieve data from relational databases. Here is a
report on SQL operators:
1. Arithmetic Operators:
● Addition (+): Adds two values.
2. Comparison Operators:
● Not equal to (!= or <>): Checks if two values are not equal.
3. Logical Operators:
● AND: Returns true if all conditions are true.
5.Aggregate Functions:
6.String Operators:
These operators enable users to perform a wide range of operations on SQL databases,
including data retrieval, filtering, sorting, aggregation, and more. By utilizing these
operators effectively, users can manipulate and extract the desired information from
the database efficiently.
SELECT 10 + 10;
– (Subtraction)
The – symbol subtracts one number from another.
SELECT 10 - 10;
* (Multiplication)
The * symbol multiples two numbers together.
SELECT 10 * 10;
/ (Division)
The / symbol divides one number by another.
SELECT 10 / 10;
% (Remainder/Modulus)
The % symbol (sometimes referred to as Modulus) returns the remainder of one
number divided by another.
SELECT 10 % 10;
Bitwise operators
A bitwise operator performs bit manipulation between two expressions of the integer
data type. Bitwise operators convert the integers into binary bits and then perform the
AND (& symbol), OR (|, ^) or NOT (~) operation on each individual bit, before
finally converting the binary result back into an integer.
+= (Add equals)
The += operator will add a value to the original value and store the result in the
original value. The below example sets a value of 10, then adds 5 to the value and
prints the result (15).
SET @addValue += 5
This can also be used on strings. The below example will concatenate two strings
together and print “dataquest”.
PRINT @addString;
-= (Subtract equals)
The -= operator will subtract a value from the original value and store the result in the
original value. The below example sets a value of 10, then subtracts 5 from the value
and prints the result (5).
SET @addValue -= 5
SET @addValue *= 5
/= (Divide equals)
The /= operator will divide a value by the original. The below example sets a value of
10, then divides it by 5 and prints the result (2).
SET @addValue /= 5
%= (Modulo equals)
The %= operator will divide a value by the original value and store the remainder in
the original value. The below example sets a value of 25, then divides by 5 and prints
the result (0).
SET @addValue %= 5
Logical operators
Logical operators are those that return true or false, such as the AND operator, which
returns true when both expressions are met.
ALL
The ALL operator returns TRUE if all of the subquery values meet the specified
condition. In the below example, we are filtering all users who have an age that is
greater than the highest age of users in London.
FROM users
WHERE age > ALL (SELECT age FROM users WHERE location = ‘London’);
ANY/SOME
The ANY operator returns TRUE if any of the subquery values meet the specified
condition. In the below example, we are filtering all products which have any record
in the orders table. The SOME operator achieves the same result.
SELECT product_name
FROM products
AND
The AND operator returns TRUE if all of the conditions separated by AND are true.
In the below example, we are filtering users that have an age of 20 and a location of
London.
SELECT *
FROM users
BETWEEN
The BETWEEN operator filters your query to only return results that fit a specified
range.
SELECT *
EXISTS
The EXISTS operator is used to filter data by looking for the presence of any record in
a subquery.
SELECT name
FROM customers
WHERE EXISTS
IN
The IN operator includes multiple values set into the WHERE clause.
SELECT *
FROM users
LIKE
The LIKE operator searches for a specified pattern in a column. (For more
information on how/why the % is used here, see the section on the wildcard character
operator).
SELECT *
FROM users
NOT
The NOT operator returns results if the condition or conditions are not true.
SELECT *
FROM users
SELECT *
FROM users
IS NULL
The IS NULL operator is used to filter results with a value of NULL.
SELECT *
FROM users
String operators
String operators are primarily used for string concatenation (combining two or more
strings together) and string pattern matching.
+ (String concatenation)
The + operator can be used to combine two or more strings together. The below
example would output ‘dataquest’.
SELECT *
FROM users
[] (Character(s) matches)
The [] is used to match any character within the specific range or set that is specified
between the square brackets. In the below example, we are searching for any users
that have a first name that begins with a d and a second character that is somewhere in
the range c to r.
SELECT *
FROM users
SELECT *
FROM users
SELECT *
FROM users
2 internet Wikipedia
3 PC windows 11 1
Outputs of the Micro-Projects
3. Ability to Retrieve and Manipulate Data: Readers will acquire the skills
to retrieve and manipulate data effectively using SQL operators. They
will understand how to construct SELECT statements with appropriate
operators and clauses to filter, sort, group, and aggregate data.
6. Data Analysis Skills: Readers will gain the ability to perform data
analysis tasks using SQL operators. They will understand how to use
aggregate operators (COUNT, SUM, AVG, MIN, MAX) to calculate
summary statistics and derive insights from their databases.
Skill Developed / Learning outcomes of this Micro-Project
The report delves into data retrieval and manipulation operators, such as
SELECT, WHERE, GROUP BY, HAVING, and ORDER BY, enabling readers
to filter, sort, group, and aggregate data effectively. It also explores set
operators (UNION, INTERSECT, EXCEPT) and join operators (INNER JOIN,
LEFT JOIN, RIGHT JOIN, FULL JOIN) to combine and compare data from
multiple tables.
The report provides practical examples and case studies that demonstrate the
application of SQL operators in real-world scenarios. It emphasizes best
practices and optimization techniques for using SQL operators effectively,
optimizing query performance, and avoiding common pitfalls.
Overall, the report equips readers with the knowledge and skills needed to work
with SQL operators confidently. It serves as a valuable resource for database
administrators, developers, data analysts, and anyone involved in database
management, data analysis, or software development. By understanding SQL
operators and their applications, readers can write efficient SQL queries,
retrieve and manipulate data effectively, perform data analysis tasks, and apply
best practices for optimal database management.