SEBA Class 10 Computer Science Chapter 3 - Database Part-II MySQL Notes PDF

SEBA Class 10 Computer Science Chapter 3 - Database Part-II MySQL Notes PDF

3.1 Introduction to Database

A database is an organized collection of related data stored electronically in a computer system. Databases help users store, manage, retrieve, and manipulate information efficiently.

Examples of databases include school management systems, banking systems, railway reservation systems, and online shopping websites.

3.2 What is DBMS?

DBMS stands for Database Management System. It is software used to create, manage, and maintain databases.

Functions of DBMS

  • Store data properly
  • Retrieve information quickly
  • Maintain security
  • Reduce data redundancy
  • Allow multi-user access

3.3 Introduction to MySQL

MySQL(My Structure Query Language) is an open-source Relational Database Management System (RDBMS) used to manage databases using SQL commands.It was developed by David Axmark, Allan Larsson, and Michael Widenius who work together since 1980s.MySQL is capable of handling large data sets and is essentially used for Web-based application. A platform independent application, it can work on various operating systems such as UNIX, LINUX, and Windows. MySQL is named after Michale Widenius's daughter MY

Features of MySQL

  • Fast and reliable
  • Easy to use
  • Supports multiple users
  • Works on different operating systems
  • Widely used in web applications

3.4 Starting MySQL

MySQL can be started using command prompt or MySQL terminal.

Steps to Open MySQL

  1. Open Command Prompt
  2. Go to MySQL installation directory
  3. Type mysql -u root -p
  4. Enter password

SQL COMMANDS

MySQL supports standard SQL, which is the standard language for communicating with and RDBMS. SQL Commands are divided into five categories:

  • DDL (Data Definition language) The statements in DDL are used to define (add/modifydelete) the database structure. these include CREATE, ALTER, DROP, truNCATE, and COMMENT commands.
  • DML (Data Manipulation Language) These statements are used for managing (add/modify/delete) the data. These include SELECT, INCERT, UPDATE, and DELETE commands, which are used to retrive and manipulate data in MySQL.
  • TCL (TransactionControl Language) TCL statement are used to manage the changes made by DML statements. These include COMMIT, DOLLBACK, and SAVEPOINT commands.
  • DCL (Data Control Language) These statement are used to gibe/ witdraw access privileges to the database user.These include GRANT and REVOKE command
  • DQL (Data Query Language) This includes SLECT, SHOW,and HELP commands. SELECT is the main DQL statement.
  • 3.5 Basic MySQL Commands

    Create Database

    CREATE DATABASE school;
    

    Use Database

    USE school;
    

    Show Databases

    SHOW DATABASES;
    

    3.6 Creating Tables in MySQL

    Tables are used to store data in rows and columns.

    Syntax

    CREATE TABLE student(
    roll INT,
    name VARCHAR(30),
    marks INT
    );
    

    3.7 MySQL Data Types

    Data Type Description
    INT Stores integer values
    VARCHAR Stores text values
    CHAR Stores fixed-length text
    FLOAT Stores decimal numbers
    DATE Stores date values

    3.8 Inserting Data into Table

    The INSERT command is used to add records into a table.

    Syntax

    INSERT INTO student
    VALUES(1,'Rahul',85);
    

    3.9 Displaying Table Data

    The SELECT command is used to display records from a table.

    Syntax

    SELECT * FROM student;
    

    3.10 WHERE Clause

    The WHERE clause is used to filter records according to conditions.

    Example

    SELECT * FROM student
    WHERE marks > 80;
    

    3.11 Operators in MySQL

    Arithmetic Operators

    • +
    • -
    • *
    • /

    Relational Operators

    • =
    • >
    • <
    • >=
    • <=
    • !=

    Logical Operators

    • AND
    • OR
    • NOT

    3.12 Updating Records

    The UPDATE command modifies existing records in a table.

    Syntax

    UPDATE student
    SET marks = 90
    WHERE roll = 1;
    

    3.13 Deleting Records

    The DELETE command removes records from a table.

    Syntax

    DELETE FROM student
    WHERE roll = 1;
    

    3.14 Changing Table Structure

    ALTER TABLE command is used to modify table structure.

    Add New Column

    ALTER TABLE student
    ADD address VARCHAR(50);
    

    3.15 Dropping Tables

    The DROP command permanently removes a table.

    DROP TABLE student;
    

    Advantages of Database

    • Easy data storage
    • Fast searching
    • Data security
    • Reduced duplication
    • Easy backup

    Limitations of Database

    • Requires technical knowledge
    • Can be costly
    • System failure may affect data

    Important Keywords

    Keyword Meaning
    DBMS Database Management System
    MySQL Relational Database Software
    Table Collection of rows and columns
    Record Single row of data
    Field Single column in table
    SQL Structured Query Language

    Summary

    In this chapter, we learned about databases, DBMS, MySQL, data types, creating tables, inserting records, updating data, deleting records, and SQL commands used to manage databases efficiently.

    Frequently Asked Questions (FAQ)

    1. What is a database?

    A database is an organized collection of related data.


    2. What is DBMS?

    DBMS is software used to manage databases.


    3. What is MySQL?

    MySQL is a relational database management system.


    4. Which command displays records?

    The SELECT command displays records from a table.


    5. Which command removes records?

    The DELETE command removes records from a table.


    📘 Chapter 3 Exercise PDF

    Read the complete Chapter 3 MySQL Notes directly on the website.


    End of Chapter 3 – Database Part-II MySQL