dbms2 File
dbms2 File
PRACTICAL DETAILS
S. Date Experiment name Marks Total Sign
No. Marks
R1 R2 R3 R4 R5
S. Date Experiment name Marks Total Sign
No. Marks
R1 R2 R3 R4 R5
EXPERIMENT-1
AIM:- Introduction to Mariadb
OUTPUT
Anushka
Anushka
Anushka ;
[Anushka]
[Anushka]
[Anushka]
[Anushka]
user@l6it159 ~]$
[user@l6it159 ~]$ su
Password: // password for su is mait_123
[root@l6it159 user]# yum install mariadb mariadb-server
Redirecting to '/usr/bin/dnf install mariadb mariadb-server' (see 'man yum2dnf')
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Experiment 2
Aim of the Experiment:Apply the integrity constraints like Primary Key, Foreign
key, Check, NOT NULL, etc. to the tables.
anushka anushka
anushka
anushka
anushka
anushka
anushka
anushka
anushka
Experiment 3 :
anushka
anushka
anushka
anushka
anushka
anushka
anushka
anushka
Experiment 4 :
Built-in Functions:
MySQL provides several built-in functions that can be used to manipulate and
transform data. Here's an example of a query that uses some of these functions:
SELECT CONCAT(first_name, ' ', last_name) AS full_name, UPPER(email) AS
email_uppercase
FROM employees;
This query uses the CONCAT and UPPER functions to concatenate the first and
last name columns into a new "full_name" column and convert the email column
to uppercase in the "email_uppercase" column.
GROUP BY:
The GROUP BY clause is used to group rows in a result set based on a
specified column or expression. Here's an example of a query that uses
GROUP BY: SELECT department, COUNT(*) AS num_employees
FROM employees
GROUP BY department;
This query groups employees by department and counts the number of
employees in each department.
HAVING:
The HAVING clause is used to filter rows in a result set based on a specified
condition. Here's an example of a query that uses HAVING:
SELECT department, AVG(salary) AS avg_salary
FROM employees
GROUP BY department
HAVING AVG(salary) > 50000;
This query groups employees by department and calculates the average
salary for each department. The HAVING clause filters the result set to show
only departments with an average salary greater than 50,000.
ORDER BY:
The ORDER BY clause is used to sort the rows in a result set based on one or
more columns. Here's an example of a query that uses ORDER BY:
SELECT first_name, last_name, salary
FROM employees
ORDER BY salary DESC;
This query selects the first name, last name, and salary columns from the
"employees" table and sorts the result set in descending order based on the
salary column.
anushka
anushka
anushka
Experiment 5:
INNER JOIN:
The INNER JOIN keyword returns only the matching rows from both tables.
Here's an example of a query that uses INNER JOIN:
SELECT orders.order_id, customers.customer_name, orders.order_date FROM
orders
INNER JOIN customers ON orders.customer_id = customers.customer_id; This
query selects the customer_name and order_id columns from the "customers" and
"orders" tables and joins the two tables on the customer_id column using LEFT
JOIN. The result set includes all rows from the "customers" table and only the
matching rows from the "orders" table.
RIGHT JOIN:
The RIGHT JOIN keyword returns all rows from the right table and the matching
rows from the left table. If there are no matching rows in the left table, the result
set will contain NULL values. Here's an example of a query that uses RIGHT
JOIN: SELECT orders.order_id, customers.customer_name
FROM orders
RIGHT JOIN customers ON orders.customer_id = customers.customer_id; This
query selects the order_id and customer_name columns from the "orders" and
"customers" tables and joins the two tables on the customer_id column using
RIGHT JOIN. The result set includes all rows from the "orders" table and only the
matching rows from the "customers" table.
By using different types of joins in MySQL, we can combine data from multiple
tables based on common columns and perform more complex queries on our data.
This allows us to retrieve and analyze data that is stored across multiple tables in a
database.
OUTPUT
ANUSHKA
ANUSHKA
ANUSHKA