Database
Database
It is collection of tables.
It is application level permanent storage which is capable to store data at
application level, this storage can be manually accessible and handled as per
requirement.
=====================
MYSQL:It is a schema based database management system used to manage and store data
in structured format.As it is structured database it manages big amount of data
using schema hence also considered as RDBMS(Relational Database Management System)
======================
CREATE TABLE StudentRecord (
Id int NOT NULL PRIMARY KEY,
Name varchar(255),
Email varchar(255),
Password varchar(255),
Gender varchar(255),
City varchar(255),
Info varchar(255),
Address varchar(255),
Mobile varchar(10)
);
==============
CREATE TABLE StudentRecord (
Id int NOT NULL PRIMARY KEY AUTO_INCREMENT ,
Name varchar(255),
Rollno varchar(255),
Course varchar(255),
Fee float(10),
Gender varchar(255),
Age int(2)
);
=================
insert query:-
===============
INSERT INTO `StudentRecord` (`Name`, `Rollno`, `Course`, `Fee`, `Gender`, `Age`)
VALUES ('Neha Sharma', 102, 'MCA', 44567.45, 'Female', 22),
('Priya Sharma', 103, 'B.Tech', 42567.45, 'Female', 21),
('Mukesh Sharma', 104, 'M.Tech', 55467.45, 'Male', 20),
('Rohit Sharma', 105, 'B.Tech', 44567.45, 'Male', 20);
==================
SELECT Name,Rollno FROM `StudentRecord`
=======================
SELECT * FROM `StudentRecord` WHERE Gender="Male"
SELECT * FROM `StudentRecord` WHERE Gender="Female"
SELECT * FROM `StudentRecord` WHERE Fee>35000.0
SELECT * FROM `StudentRecord` WHERE Age BETWEEN 20 and 30
SELECT * FROM `StudentRecord` WHERE Fee > 40000 AND Gender='Male'
SELECT * FROM `StudentRecord` WHERE Fee=35000.0 OR Fee>50000.0
SELECT * FROM `StudentRecord` ORDER BY Age
SELECT * FROM `StudentRecord` ORDER BY Age DESC
SELECT COUNT(*) FROM `StudentRecord`
SELECT max(age) FROM `StudentRecord`
SELECT min(age) FROM `StudentRecord`
SELECT avg(age) FROM `StudentRecord`
select Gender,COUNT(*) from StudentRecord group by Gender
select Course,COUNT(*) from StudentRecord group by Course
UPDATE StudentRecord SET Fee=25000.0 WHERE Rollno=102
UPDATE StudentRecord SET Fee=25000.0 , AGE=23 WHERE Rollno=102
UPDATE StudentRecord SET Fee=Fee+1000.0
DELETE FROM `StudentRecord` WHERE Rollno=2