0% found this document useful (0 votes)
16 views

SQL

MY SQL INTERSHIP
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

SQL

MY SQL INTERSHIP
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

INTERNSHIP PROJECT

On
MY SQL
A project report submitted in partial fulfilment of the requirements for award of the
Degree of

BACHELOR OF TECHNOLOGY

In
COMPUTER SCIENCE AND ENGINEERING

IS A BONAFIED RECORD OF WORK DONE BY

Submitted by

KILARI VYSHNAVI 22KP1A0558

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

NRI INSTITUTE OF TECHNOLOGY


(Approved by AICTE, Affiliated to JNTU, Kakinada.)

VISADALA (P.O.), MEDIKONDURU MANDAL, GUNTUR-522438 , ANDHRA


PRADESH.

2022-2026
CERTIFICATE

This is to certify that the project report entitled “MY SQL” is a Bonafide record
of work carried out by the KILARI VYSHNAVI (22KP1A0558)
carried out the research under the super vision. Certified further, that to the best of
knowledge the work reported here in does not form part of any other Project
report or dissertation on the basis of which a degree of award was conferred on an
earlier occasion on this or any other candidates.

This work is done under the supervision and guidance.

Signature of Head of the dept.

MR.Dr.K. NAGESWARARAO Ph.D

PROFESSOR & HOD


Signature of Faculty:-
ACKNOWLEDGEMENT

It is a great pleasure to convey our sincere thanks to our Hon’ble Chairman


Dr.Alapati Ravindra garu and Hon’ble Secretary and Correspondent Sri Alapati
Rajendra Prasad garu for providing excellent facilities and everything for our
success.
Our sincere thanks to respected Principal, Dr. KOTA SRINIVASU garu for his co –
operation and valuable suggestions during our stay in this institute.
We thank our respected Executive director, Chief Executive Officer, Chief
Finance Officer and Administrative Officer for their co-operation and
valuable support during our stay in this institute. We thank respected Vice
Principal for his valuable suggestions and motivation during our stay.
Our heartfelt thanks to beloved HOD of our department Dr.
KOTESWARARO RAO for his motivation, care and valuable guidance at
every step of our project work and in every aspect for our success.
We are highly indebted to our coordinator , MS.Dr.N.KANTHI PRIYA DARSHINI
Department of COMPUTER SCIENCE AND ENGINEERING,NRI INSTITUTE OF
TECHNOLOGY, VISADALA, MEDIKONDURU, GUNTUR for his valuable guidance
in the successful completion of our Intenship. We are very much indebted to her for
suggesting this interesting topic and helping us at every stage for its successful
completion.
We thank wholeheartedly our project coordinator, MS.Dr.KANTHI PRIYA DARSHINI ,
For their special care towards completion of our Internship in smooth manner.

It’s our pleasure to thank all the faculty members of CSE department for extending
their constant co-operation and support during our stay in NRIIT.
Our heartiest thanks to our beloved parents who are well behind us for all our success
as well as achievements.
Finally, we thank all our friends who helped either directly or indirectly to achieve
our GOAL.

NAME ROLL NO
KILARI VYSHNAVI 22KP1A0558
DECLARATION

We hereby declare that the work which is being presented in the Dissertation Entitled
“MY SQL” submitted towards the partial of fulfillment of requirements for the award
of the degree in Bachelor of Technology and authentic record in Department of
Computer Science And Engineering at NRI Institute of Technology, Guntur.

The matter embodied in this dissertation report has not been submitted
by us for the award of any other degree. Further the technical details
furnished in the various chapters in this report are purely relevant to the
above project and there is no deviation from the theoretical point of
view for design, development and implementation.

NAME ROLL NO

K.VYSHNAVI 22KP1A0558
CONTENTS

Module 1: Introduction to MySQL

- Overview of MySQL and relational databases

- Installing MySQL Server and MySQL Workbench

- Basic MySQL commands (SHOW, DESCRIBE, USE)

Module 2: Database and Table Management

- Creating, modifying, and deleting databases

- Creating, altering, and dropping tables

- Data types in MySQL (e.g., INT, VARCHAR, DATE, etc.)

- Constraints: PRIMARY KEY, UNIQUE, FOREIGN KEY, NOT NULL, DEFAULT

Module 3: Data Retrieval and Queries

- Basic SELECT queries

- Filtering data with WHERE

- Sorting data with ORDER BY

- Limiting results with LIMIT

Module 4: Joins and Relationships

- Types of joins: INNER JOIN, LEFT JOIN, RIGHT JOIN, CROSS JOIN

- Self-joins and subqueries

- Using GROUP BY and aggregate functions (COUNT, SUM, AVG, MAX, MIN)

- Filtering grouped data with HAVING


Module 5: Data Manipulation

- Inserting data into tables (INSERT INTO)

- Updating data (UPDATE)

- Deleting data (DELETE, TRUNCATE)

- Using transactions (START TRANSACTION, COMMIT, ROLLBACK)

Module 6: Indexing and Optimization

- Creating and managing indexes (PRIMARY, UNIQUE, FULLTEXT)

- Query optimization and EXPLAIN plan

- Improving query performance

Module 7: Stored Procedures, Functions, and Triggers

- Creating and using stored procedures and functions

- Creating and using triggers

- Event scheduling

Module 8: User Management and Security

- Creating and managing MySQL user accounts

- Assigning privileges and roles (GRANT, REVOKE)

- Securing MySQL with SSL, password management, and encryption


Module 9: Backup, Restore, and Maintenance

- Database backup using mysqldump

- Restoring databases from backups

- Database optimization and maintenance techniques

Module 10: Advanced Topics (Optional)

Master-slave replication in MySQL

Sharding and partitioning

Integration with programming languages (PHP, Python, Node.js)

This structure provides a solid foundation for learning MySQL from basic to
advanced concepts.
Introduction
1.Databases and MySQL :
What is a Database?
A database is an organized collection of data that is structured for efficient retrieval and
modification.
Example: A library database with tables for books, authors, and borrowers.

Introduction to RDBMS (Relational Database Management System)


RDBMS stores data in tables (relations) where each table consists of rows and columns.
Example: MySQL, PostgreSQL, Oracle.

Installing MySQL and Setting up a Database


How to install MySQL on different operating systems (Linux, Windows, Mac).
Example:
bash
sudo apt-get install mysql-server
mysql -u root -p

2. Basic SQL Queries


Creating a Database and Table
Syntax for creating a database and tables.
Example:
sql
CREATE DATABASE school;
USE school;
CREATE TABLE students (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
age INT,
grade VARCHAR(10)
);
Inserting Data into Tables
Inserting single and multiple rows.
Example:
sql
INSERT INTO students (name, age, grade) VALUES ('John Doe', 15, '10th');
INSERT INTO students (name, age, grade) VALUES ('Jane Smith', 14, '9th');

Basic SELECT Queries


Retrieving data using SELECT.
Example:
sql
SELECT * FROM students; -- Retrieve all columns
SELECT name, age FROM students; -- Retrieve specific columns

WHERE Clause
Filtering data with conditions.
Example:
sql
SELECT * FROM students WHERE age > 14;

3. Data Manipulation
Statement
Modifying existing data.

Example:
sql
UPDATE students SET grade = '11th' WHERE name = 'John Doe';

DELETE Statement
Removing data from a table.
Example:
Sql
DELETE FROM students WHERE age < 15;

INSERT INTO SELECT


Inserting data into one table from another.
Example:
Sql
INSERT INTO students_archive (id, name, age, grade)
SELECT id, name, age, grade FROM students WHERE age < 15;

4. Constraints and Indexes


PRIMARY KEY
Ensuring unique identification for rows in a table.
Example:
Sql
CREATE TABLE books (
book_id INT PRIMARY KEY,
title VARCHAR(255)
)
FOREIGN KEY
Linking tables by referencing another table's primary key.

Example:
Sql
CREATE TABLE orders (
order_id INT PRIMARY KEY,
customer_id INT,
FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
);
NULL, UNIQUE, DEFAULT
Enforcing constraints on columns.
Example:
sql
CREATE TABLE employees (
emp_id INT NOT NULL,
emp_name VARCHAR(100) UNIQUE,
hire_date DATE DEFAULT CURRENT_DATE
);

INDEXES
Speeding up data retrieval using indexes.
Example:
sql
CREATE INDEX idx_name ON students (name);

5. Advanced SQL Queries


JOINs (INNER, LEFT, RIGHT, FULL OUTER)
Combining rows from two or more tables.
Example:
sql
SELECT students.name, courses.name
FROM students
INNER JOIN course_enrollments ON students.id = course_enrollments.student_id
INNER JOIN courses ON course_enrollments.course_id = courses.id;
GROUP BY and HAVING
Aggregating data and applying conditions on groups.
Example:
sql
SELECT grade, COUNT(*) FROM students GROUP BY grade HAVING COUNT(*) > 1;

ORDER BY Clause
Sorting results by one or more columns.
Example:
sql
SELECT * FROM students ORDER BY age DESC;

LIMIT Clause
Limiting the number of rows returned.
Example:
sql
SELECT * FROM students LIMIT 5;

6. Functions and Subqueries


Aggregate Functions
Functions like COUNT(), SUM(), AVG(), MIN(), MAX().

Example:
sql
SELECT AVG(age) FROM students;
String Functions
Functions like CONCAT(), UPPER(), LOWER(), LENGTH().
Example:
sql
SELECT CONCAT(first_name, ' ', last_name) FROM employees;
ate Functions
Functions like NOW(), DATE(), YEAR(), MONTH(), DAY().
Example:
sql
SELECT YEAR(hire_date) FROM employees;
Subqueries
Queries within queries, often used in WHERE or FROM clauses.
Example:
sql
SELECT name FROM students WHERE id IN (SELECT student_id FROM
course_enrollments WHERE course_id = 101);

7. Database Normalization
First Normal Form (1NF)
Ensuring each column contains atomic values, and each record is unique.

Example:
sql
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(100),
department VARCHAR(100)
);
Second Normal Form (2NF)
Removing partial dependency (dependencies on part of the primary key).

Third Normal Form (3NF)


Ensuring that non-key attributes are not transitively dependent on the primary key.
8. Transactions and ACID Properties
What is a Transaction?
A sequence of operations performed as a single unit of work.

ACID Properties
Atomicity: All or nothing.
Consistency: Database must transition from one valid state to another.
Isolation: Transactions do not affect each other.
Durability: Changes are permanent.
Using BEGIN, COMMIT, and ROLLBACK**
Example:
sql
BEGIN;
UPDATE account SET balance = balance - 100 WHERE account_id = 1;
UPDATE account SET balance = balance + 100 WHERE account_id = 2;
COMMIT;

9. MySQL Performance Optimization


Query Optimization
Using EXPLAIN to analyze queries.
Example:
sql
EXPLAIN SELECT * FROM students WHERE age > 14;
Indexes for Faster Queries
Creating indexes on frequently searched columns.

Using LIMIT and Efficient Pagination


Limiting result set size for performance.
Caching and Query Cache
Using the query cache to store and reuse result sets for frequent queries.

10. Security in MySQL


User Management and Privileges
Creating and managing users, granting privileges.

Example:
sql
CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT, INSERT ON school.* TO 'new_user'@'localhost';
Securing Connections (SSL/TLS)
Setting up encrypted connections to MySQL.
Backing Up and Restoring Databases
Using mysqldump for backups.
Example:
bash
mysqldump -u root -p school > school_backup.sq

11. MySQL Administration and Maintenance


Database Backup and Recovery
Regular backups using tools like mysqldump.

Monitoring MySQL Server


Using MySQL logs and performance monitoring tools.

Database Partitioning
Partitioning large tables to improve performance.

Conclusion :
This syllabus covers a broad range of MySQL topics, from the basics of database creation to
advanced performance tuning and security. By following this roadmap, you will be able to
build, maintain, and optimize MySQL databases effectively. Practice through examples and
real-world projects will solidify your understanding of MySQL concepts. PROFESSOR &
HOD

You might also like