0% found this document useful (0 votes)
29 views15 pages

Mysql

The document provides an overview of MySQL, including that it is a database system used widely on the web. It discusses SQL commands for creating databases and tables, inserting, updating, and deleting data. It also covers keys like primary keys and foreign keys, and provides examples of SQL queries for these functions.

Uploaded by

Atiqur Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views15 pages

Mysql

The document provides an overview of MySQL, including that it is a database system used widely on the web. It discusses SQL commands for creating databases and tables, inserting, updating, and deleting data. It also covers keys like primary keys and foreign keys, and provides examples of SQL queries for these functions.

Uploaded by

Atiqur Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Presentation Of

MYSQL

Presented by
Md Atiqur Rahman (Polash)
Chief Technical Officer(CTO)
Doel e-Services
Web: doelhosting.com
Email: [email protected]
Mobile:01720981682
7/30/23 Web Design and Development 1
Today’s Objective
• MySQL
• SQL Commands
• create database
• MySQL Table
• Constraint
• Key
• Database Queries

7/30/23 Web Design and Development 2


What is MySQL?

• MySQL is a database system used on the web


• MySQL is a database system that runs on a server
• MySQL is ideal for both small and large applications
• MySQL is very fast, reliable, and easy to use
• MySQL uses standard SQL
• MySQL compiles on a number of platforms
• MySQL is free to download and use
• MySQL is developed, distributed, and supported by Oracle
Corporation
• MySQL is named after co-founder Monty Widenius's daughter:
My

7/30/23 Web Design and Development 3


• The data in a MySQL database are stored in tables. A
table is a collection of related data, and it consists
of columns and rows.
• Databases are useful for storing information
categorically. A company may have a database with
the following tables:
– Employees
– Products
– Customers
– Orders

7/30/23 Web Design and Development 4


What Can SQL do?

• SQL can execute queries against a database


• SQL can retrieve data from a database
• SQL can insert records in a database
• SQL can update records in a database
• SQL can delete records from a database
• SQL can create new databases
• SQL can create new tables in a database
• SQL can create stored procedures in a database
• SQL can create views in a database
• SQL can set permissions on tables, procedures, and views
7/30/23 Web Design and Development 5
Most Important SQL Commands

• SELECT - extracts data from a database


• UPDATE - updates data in a database
• DELETE - deletes data from a database
• INSERT INTO - inserts new data into a database
• CREATE DATABASE - creates a new database
• ALTER DATABASE - modifies a database
• CREATE TABLE - creates a new table
• ALTER TABLE - modifies a table
• DROP TABLE - deletes a table
• CREATE INDEX - creates an index (search key)
• DROP INDEX - deletes an index

7/30/23 Web Design and Development 6


How to create database
• At first you open your web browser then go
localhost/phpmyadmin
• Click the Databases .show Create database
• Fill up database name and select collation
then click create.
• Create Database Table: click database name
then you show create table fill up name and
Number of columns then click go

7/30/23 Web Design and Development 7


Create a MySQL Table

• CREATE TABLE napd_trainer_history(


id INT(6) UNSIGNED AUTO_INCREMENT
PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP
)

7/30/23 Web Design and Development 8


example
• The CREATE TABLE statement is used to create a new table in a database.
• CREATE TABLE table_name (
    column1 datatype,
    column2 datatype,
    column3 datatype,
   ....
);
• CREATE TABLE Persons
• (
• PersonID int,
• LastName varchar(255),
• FirstName varchar(255),
• Address varchar(255),
• City varchar(255)
• );

7/30/23 Web Design and Development 9


UNIQUE Constraint

• The UNIQUE constraint ensures that all values in a


column are different.
• Both the UNIQUE and PRIMARY KEY constraints
provide a guarantee for uniqueness for a column or
set of columns.
• A PRIMARY KEY constraint automatically has a
UNIQUE constraint.
• However, you can have many UNIQUE constraints per
table, but only one PRIMARY KEY constraint per table.

7/30/23 Web Design and Development 10


PRIMARY KEY

• The PRIMARY KEY constraint uniquely


identifies each record in a database table.
• Primary keys must contain UNIQUE values,
and cannot contain NULL values.
• A table can have only one primary key, which
may consist of single or multiple fields.

7/30/23 Web Design and Development 11


FOREIGN KEY

• A FOREIGN KEY is a key used to link two tables


together.
• A FOREIGN KEY in a table points to a PRIMARY
KEY in another table.

7/30/23 Web Design and Development 12


Database Queries
• A query is a question or a request.
• We can query a database for specific information
and have a record set returned.
• Look at the following query (using standard SQL):
• SELECT column_name FROM Table_name
• The query above selects all the data in the "
column_name " column from the " Table_name
" table.

7/30/23 Web Design and Development 13


Database Queries Example
• INSERT INTO napd_trainer_history(id,
firstname , lastname , email, reg_date )
VALUES (‘’,Atiqur Rahman', Polash',
'[email protected]‘,’25/01/2016’)
• UPDATE napd_trainer_history SET
lastname=‘Polash Trainer' WHERE id=‘2’
• SELECT * FROM napd_trainer_history LIMIT 0,1;
• DELETE FROM napd_trainer_history WHERE
id=‘2’
7/30/23 Web Design and Development 14
Any Question

7/30/23 Web Design and Development 15

You might also like