0% found this document useful (0 votes)
22 views5 pages

SQL Notes Class 9.1736410857

The document provides an overview of MySQL, a widely used open-source database management system for managing relational databases. It outlines key features of MySQL, such as maintaining referential integrity and supporting various database operations, along with commands for creating and managing databases and tables. Additionally, it includes specific SQL commands for tasks like inserting, updating, and deleting data within a database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views5 pages

SQL Notes Class 9.1736410857

The document provides an overview of MySQL, a widely used open-source database management system for managing relational databases. It outlines key features of MySQL, such as maintaining referential integrity and supporting various database operations, along with commands for creating and managing databases and tables. Additionally, it includes specific SQL commands for tasks like inserting, updating, and deleting data within a database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

SADHU VASWANI INTERNATIONAL SCHOOL.

Notes : Class 9
Topic-MY SQL
The data-driven world of today requires a lot of data to function. A majority of
the data is stored as databases, which is an organized collection of data. A
database management system or DBMS in short acts as a bridge between the
database and end-user to ensure that the data is well organized and easily
accessible. A DBMS assists in optimizing, storing, retrieving, and managing data in
databases.
MySQL is the most widely used database management system software for
managing relational databases today. It is an open-source database that is
supported by the Oracle Corporation. Many small and large businesses use
MySQL. It supports a variety of operating systems, including Windows, Linux,
macOS, and others. MySQL is a Relational Database Management System
(RDBMS) that offers a variety of features, including:It allows us to use tables,
rows, columns, and indexes and to perform database operations on them.
• Tables (collection of rows and columns), also known as relations, are used
to construct database relationships.
• It ensures that the Referential Integrity (referential integrity is an RDBMS
concept which states that any foreign key field must agree with the primary
key that is referenced by the foreign key) between rows or columns of
different tables is maintained.
• It automatically updates the table indexes as soon as a record is changed.
• It employs a number of SQL queries and integrates useful data from many
columns and rows for end-users.

Working with databases


A database is a collection of organized records that the user can conveniently
access and manage. It organizes the data into tables, rows, columns, and indexes
to make it easier to retrieve the information we need quickly. Let’s try to build a
student database using the following command.
The following syntax can create a database. It also verifies whether the database
name is already in use.
Commands
1. Creating new database;
create database svis;
//svis is name given to the database

2. View list of all created databases.


show databases;

3. Using your database


use svis;

4. Creating table in the database.


create table student(rollno int PRIMARY KEY,class int,address
varchar(50),hobby varchar(100),div int);

5. View the layout of the created table;


describe student;

6. To view list of all tables existing in the current database.


show tables;

7. Insert values into the table you created.


insert into student(rollno,class,address,hobby,div)
values(1,9,’moshi’,’dancing’,A);

8. View the table with values inserted.


select * from student;

9.update the existing table by adding a new coloumn.


alter table student add adharno int;

10.update the existing table by deleting a coloumn.


alter table student drop adharno ;
11.Deleting a table.
drop table student;

12.View selected fields from the table.


select name,class from student;

13. View selected fields from the table satisfying the specified condition.
select name,class from student where class>5;
14. Counting the number of rows in a table.
select count(*) from student;

15. Counting the number of rows in a table.


select count(*) from student;

16. You can sort a result set in ascending and descending order by writing the
following code.
SELECT select_list FROM student ORDER BY name ASC, class DESC;

17. Group rows using the GROUP BY clause.


SELECT select_list FROM student GROUP BY name,class.

18. Updating existing table values.


Update student set name=’Nisha’ where rollno=1;
(This can be done for multiple fields also at a time)

19. To delete a rows specified by a condition:


delete from student where rollno=2;

You might also like