You are on page 1of 22

Informatics

Practices
Project
By
name
Academic year 2023-24
ACKNOWLED
GEMENT
I would like to extend my heartfelt thanks to my
teacher name, for providing me with the
opportunity to undertake this project and for
their constant guidance and expertise. Their
valuable insights and feedback have greatly
enhanced the quality of my work.
I would also like to thank our principal for
giving me this great opportunity to do a project.
Without their support and suggestions, this
project would not have been completed.
CERTIFICATE
This is to certify that <name> of
class <class> has completed his
Informatics Practices project
under the guidance of <teacher
name> for the academic year
2023-2024.
Teacher Signature
________________
Index
S.no
Topic
Page.no

Create database
1
2 Use database

3 Create table

4 Describe table

5 Adding columns

6 Describe table

7 change call name

8 display table
9 drop column
10 insert data into table
11 displaying name with condition
12 find min Max,sum,and,average of the marks
13 Query to order
14 Delete the details of table
15
delete table
16
delete database
17

18
MySQL Queries
Create database -
>>Create database <database name> ;

Use database –
>>use <database name> ;

Create table :-
Creates a table named "Students" with columns for student ID,
name, marks, and class.
>> create table <table name>

Adding Columns:
Adds a new column named "new_column" to the "Students"
table.
>> ALTER TABLE table_name
ADD column_name datatype;

Change column name :-


Renames the "new_column" to "new_name" in the
"Students" table.
>>ALTER TABLE Students CHANGE COLUMN new_column
new_name VARCHAR(50);

Delete a column :-
Removes a specified column from the "Students" table.
>>ALTER TABLE Students DROP COLUMN column_to_drop;

Insert Data Into Table:


--Inserts a new row with data into the table
>>INSERT INTO Students VALUES (Values);
Change the mobile number of any one student
>>UPDATE Students
SET mobile_number = 'new_mobile_number'
WHERE student_id = 'student_id_to_update'
Display the details of those students which
name start with ‘A’
 To display the details of students whose names start with 'A', you
can use the SELECT statement with the LIKE operator. Here's an
example :

>>SELECT * FROM Students WHERE name LIKE 'A%’;


Display
LENGTH
>>SELECT LENGTH(NAME), SUBSTR(NAME, 3,3) FROM STUDENT
Display DISTINCT value
To display distinct values for a specific column, you can use the
DISTINCT keyword in a SELECT statement. If you want to display
distinct names from the "Students" table, for example, you
would do something like this:

>>SELECT COUNT (DISTINCT GENDER) FROM STUDENT;


Find the min, max, sum, and
average
To find the minimum, maximum, sum, and average of a numeric column
in a table, you can use the MIN, MAX, SUM, and AVG aggregate
functions.
SELECT
MIN(column_name) AS min_value,
MAX(column_name) AS max_value,
SUM(column_name) AS sum_value,
AVG(column_name) AS avg_value
FROM your_table;

Display the Gender, Minimum marks and


Maximum Marks Gender wise.
To display the gender along with the minimum and maximum marks
gender-wise, you can use the GROUP BY clause along with the MIN and
MAX aggregate functions. Here's an example assuming you have a
"Students" table with columns like gender and marks:

>>SELECT gender, MIN(marks) AS min_marks, MAX(marks) AS


max_marks FROM Students GROUP BY gender;
Write a SQL query to order the (student
ID, marks) table in descending order of
the marks
To order the "Students" table by both student ID and marks in
descending order of the marks, you can use the ORDER BY clause.
>>SELECT student_id, marks FROM Students ORDER BY marks DESC;

Delete the details of a student


in the above table
To delete the details of a student from the "Students" table based on a
specific condition (e.g., student ID), you can use the DELETE statement
with a WHERE clause. Here's an example query:
>>DELETE FROM Students WHERE student_id = 2;
Delete the table
Student
To delete a table in SQL, you use the DROP TABLE statement. If you want to delete
the "Students" table,

>> DROP TABLE Students;

Delete the Database


To delete a database in SQL, you use the DROP DATABASE
statement. If you want to delete the "School" database
>>DROP DATABASE <database name>;

You might also like