SlideShare a Scribd company logo
MYSQL BASICS
OVERVIEW OF MYSQLwhat is mysql?Where to download mysql?What is database?What is sql?Basic queries in mysql?
MYSQLMysql is the most popular open source database system Mysql is a relational databasemanagement system It is a free SQL server database server licensed with GNU www.gnu.org
STEPS TO DOWNLOAD MYSQL1.goto www.mysql.com2.click on downloads3.choose the host operating system4.download and run mysql5.go back and click on gui tools6.download and run mysql gui tools
DatabaseData: known facts that can be recorded and that have implicit meaningDatabase: collection of related data.It is a logical collection of coherent data with some inherent meaning.DBMS: A computerised record-keeping system.
Goals of a DBMS:To provide an efficient and convenient environment for accessing data in dbIt is a general purpose facility for:Defining dbConstructing dbManipulating db
SQL-structured query languageSQL is now the standard language for commercial relational DBMS.It has statements for data definitions, queries and updates.
START MYSQL SERVER:log in as root under linux with the command safe_mysqld &1) without any password:mysql -u <user> -h <host>2)with password:mysql -u <user> -h <host> -p ex: mysql –u root –h localhostdesc: -u option is used to log in as a root and –p option tells mysql to query for the password.
BASIC QUERIES IN MYSQL1.CREATE TABLE    create table table_name(column1 data type(NULL||NOT NULL);desc: creates a table.2.SHOW table    show CREATE TABLE table_name;desc: shows the table in your database.
 3.INSERT insert into table_namevalues[‘value1’,’value2’,……..);desc: inserts new rows of data into the database.4.SELECTselect * from table table_name.desc: returns data from the table.
5.SELECTselect column1,column2,…from table1,table2,….[where conditions][group by column1,column2,..][having conditions][order by column1,column2,…]desc: returns data from one or more database tables.
6.UPDATEupdate table_name set column1=‘value1’,column2=‘values’,…[where conditions]desc: updates existing data in the table.7.DELETEdelete from table_name[where conditions]desc: deletes rows of data from a table.
Mysql classes1.SELECTselect *select col1,col2,…select distinct(column)select count(*)desc: defines columns to display as part of query output.
2.FROMfrom table1,table2,table3,..Desc: defines tables from which to retrieve data.3. GROUP BYgroup by grp_col1,grp_col2,…desc: a form of a sorting.         Used to divide output into logical groups.
4.HAVINGhaving grp_col1=‘value1’AND grp_col2=‘value2’desc: similar to the where clause, used to place conditions on the group clause.5.ORDER BYorder by col1,col2,…desc: used to sort a query’s result.
mysql functions:1.rand()desc: returns random values2.sum()desc: returns the sum of the values.3.now()desc: returns the time and date of the system.4.count()desc: returns the count of the values which satisfy the given condition.
sample code to create a table employee and run  basic queries using mysql on windows operating system:Mysql>create  table employee(Ssn INT NOT NULL,Salary INT,Name VARCHAR(20)Department VARCHAR(20),Primary key(ssn));Query ok, 0 rows affected (0.04 sec)
Mysql>insert into employeeValues(100,10000,’sneha’,’finance’);Query ok, 1 row affected(0.04 sec)Mysql>insert into employeeValues(200,20000,’shalini’,’hr’);Query ok, 1 row affected(0.04 sec)
Mysql>insert into employeeValues(300,30000,’john’,’finance’);Query ok, 1 row affected(0.04 sec)Mysql>insert into employeeValues(400,40000,’jack’,’hr’);Query ok, 1 row affected(0.04 sec)
Mysql>select * from employee;
Mysql>select department, count(*) as number from employee group by department order by number desc;
Mysql>DESC EMPLOYEE;
Mysql>show create table employee;
Mysql> select name, ssn from employee order by ssn desc limit 2;
Mysql>update employee set salary=9000 where ssn=400;Mysql>select * from employee;
Mysql>delete from employeewhere name=‘jack’;mysql>select * from employee;
Mysql>drop table employee;query ok, 0 rows affected (0.04 sec)Mysql>select * from employee;ERROR 1146 (42S02): Table ‘mysql.employee’ doesn’t existuse quit or exit to come out of mysql.Mysql>quit
Advantages of mysql:1.Its most reliable.2.Easy to use.3.Very fast.4.Multithreadedmulti-user and5.Robust sqldatabase server.
Visit more self help tutorialsPick a tutorial of your choice and browse through it at your own pace.The tutorials section is free, self-guiding and will not involve any additional support.Visit us at www.dataminingtools.net

More Related Content

PDF
MySQL Tutorial For Beginners | Relational Database Management System | MySQL ...
PPTX
Key-Value NoSQL Database
PDF
SQL Overview
PPTX
The Basics of MongoDB
PDF
Top 65 SQL Interview Questions and Answers | Edureka
PPTX
Introduction to MongoDB
PPTX
Data models in NoSQL
PPTX
introdution to SQL and SQL functions
MySQL Tutorial For Beginners | Relational Database Management System | MySQL ...
Key-Value NoSQL Database
SQL Overview
The Basics of MongoDB
Top 65 SQL Interview Questions and Answers | Edureka
Introduction to MongoDB
Data models in NoSQL
introdution to SQL and SQL functions

What's hot (20)

PPTX
Presentation slides of Sequence Query Language (SQL)
PPTX
Introduction To HBase
PPTX
Apache HBase™
PDF
NOSQL- Presentation on NoSQL
PDF
Database design & Normalization (1NF, 2NF, 3NF)
PPT
Introduction to MongoDB
PPSX
A Seminar on NoSQL Databases.
PPTX
An Introduction To Oracle Database
PPTX
The Right (and Wrong) Use Cases for MongoDB
ODP
Apache hadoop hbase
PPTX
Liquibase migration for data bases
PPT
7. Key-Value Databases: In Depth
PPT
SQL Queries
PPTX
Chapter 1 introduction to sql server
PPTX
NoSQL databases - An introduction
ODP
Ms sql-server
PPT
Database performance tuning and query optimization
PDF
MongoDB Fundamentals
PPTX
NOSQL Databases types and Uses
PPTX
Lect 08 materialized view
Presentation slides of Sequence Query Language (SQL)
Introduction To HBase
Apache HBase™
NOSQL- Presentation on NoSQL
Database design & Normalization (1NF, 2NF, 3NF)
Introduction to MongoDB
A Seminar on NoSQL Databases.
An Introduction To Oracle Database
The Right (and Wrong) Use Cases for MongoDB
Apache hadoop hbase
Liquibase migration for data bases
7. Key-Value Databases: In Depth
SQL Queries
Chapter 1 introduction to sql server
NoSQL databases - An introduction
Ms sql-server
Database performance tuning and query optimization
MongoDB Fundamentals
NOSQL Databases types and Uses
Lect 08 materialized view
Ad

Viewers also liked (9)

PPT
MySQL入門介紹
PPT
Mysql tutorial commands_part1
PDF
A beginners guide to MariaDB
PDF
Sql update statement
PDF
Why MariaDB?
PDF
MariaDB 10: The Complete Tutorial
PDF
Chapter 1 Fundamentals of Database Management System
DOCX
Ccna command
PDF
Routing and switching essentials companion guide
MySQL入門介紹
Mysql tutorial commands_part1
A beginners guide to MariaDB
Sql update statement
Why MariaDB?
MariaDB 10: The Complete Tutorial
Chapter 1 Fundamentals of Database Management System
Ccna command
Routing and switching essentials companion guide
Ad

Similar to MySQL Basics (20)

PPTX
Pyhton with Mysql to perform CRUD operations.pptx
PPTX
Introduction databases and MYSQL
PPTX
PHP mysql Introduction database
PPT
MySQL Presentation
PPT
mysqlHiep.ppt
PPT
MySQL Database System Hiep Dinh
PDF
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
PPT
MySql slides (ppt)
PPTX
Using Mysql.pptx
PPTX
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
PPTX
Learn PHP Lacture2
PPTX
Getting Started with MySQL I
PPTX
PYTHON_DATABASE_CONNECTIVITY_for_class_12.pptx
PPTX
PYTHON_DATABASE_CONNECTIVITY.pptxPYTHON_DATABASE
PDF
Complete SQL in one video by shradha.pdf
PDF
Chapter – 6 SQL Lab Tutorial.pdf
PPTX
MySQL with PHP
PPT
MySQL and its basic commands
Pyhton with Mysql to perform CRUD operations.pptx
Introduction databases and MYSQL
PHP mysql Introduction database
MySQL Presentation
mysqlHiep.ppt
MySQL Database System Hiep Dinh
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySql slides (ppt)
Using Mysql.pptx
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
Learn PHP Lacture2
Getting Started with MySQL I
PYTHON_DATABASE_CONNECTIVITY_for_class_12.pptx
PYTHON_DATABASE_CONNECTIVITY.pptxPYTHON_DATABASE
Complete SQL in one video by shradha.pdf
Chapter – 6 SQL Lab Tutorial.pdf
MySQL with PHP
MySQL and its basic commands

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Approach and Philosophy of On baking technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Teaching material agriculture food technology
20250228 LYD VKU AI Blended-Learning.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
SOPHOS-XG Firewall Administrator PPT.pptx
MYSQL Presentation for SQL database connectivity
Group 1 Presentation -Planning and Decision Making .pptx
Spectral efficient network and resource selection model in 5G networks
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
Agricultural_Statistics_at_a_Glance_2022_0.pdf
A comparative analysis of optical character recognition models for extracting...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Programs and apps: productivity, graphics, security and other tools
Approach and Philosophy of On baking technology
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?
Assigned Numbers - 2025 - Bluetooth® Document
Digital-Transformation-Roadmap-for-Companies.pptx
Spectroscopy.pptx food analysis technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

MySQL Basics

  • 2. OVERVIEW OF MYSQLwhat is mysql?Where to download mysql?What is database?What is sql?Basic queries in mysql?
  • 3. MYSQLMysql is the most popular open source database system Mysql is a relational databasemanagement system It is a free SQL server database server licensed with GNU www.gnu.org
  • 4. STEPS TO DOWNLOAD MYSQL1.goto www.mysql.com2.click on downloads3.choose the host operating system4.download and run mysql5.go back and click on gui tools6.download and run mysql gui tools
  • 5. DatabaseData: known facts that can be recorded and that have implicit meaningDatabase: collection of related data.It is a logical collection of coherent data with some inherent meaning.DBMS: A computerised record-keeping system.
  • 6. Goals of a DBMS:To provide an efficient and convenient environment for accessing data in dbIt is a general purpose facility for:Defining dbConstructing dbManipulating db
  • 7. SQL-structured query languageSQL is now the standard language for commercial relational DBMS.It has statements for data definitions, queries and updates.
  • 8. START MYSQL SERVER:log in as root under linux with the command safe_mysqld &1) without any password:mysql -u <user> -h <host>2)with password:mysql -u <user> -h <host> -p ex: mysql –u root –h localhostdesc: -u option is used to log in as a root and –p option tells mysql to query for the password.
  • 9. BASIC QUERIES IN MYSQL1.CREATE TABLE create table table_name(column1 data type(NULL||NOT NULL);desc: creates a table.2.SHOW table show CREATE TABLE table_name;desc: shows the table in your database.
  • 10. 3.INSERT insert into table_namevalues[‘value1’,’value2’,……..);desc: inserts new rows of data into the database.4.SELECTselect * from table table_name.desc: returns data from the table.
  • 11. 5.SELECTselect column1,column2,…from table1,table2,….[where conditions][group by column1,column2,..][having conditions][order by column1,column2,…]desc: returns data from one or more database tables.
  • 12. 6.UPDATEupdate table_name set column1=‘value1’,column2=‘values’,…[where conditions]desc: updates existing data in the table.7.DELETEdelete from table_name[where conditions]desc: deletes rows of data from a table.
  • 13. Mysql classes1.SELECTselect *select col1,col2,…select distinct(column)select count(*)desc: defines columns to display as part of query output.
  • 14. 2.FROMfrom table1,table2,table3,..Desc: defines tables from which to retrieve data.3. GROUP BYgroup by grp_col1,grp_col2,…desc: a form of a sorting. Used to divide output into logical groups.
  • 15. 4.HAVINGhaving grp_col1=‘value1’AND grp_col2=‘value2’desc: similar to the where clause, used to place conditions on the group clause.5.ORDER BYorder by col1,col2,…desc: used to sort a query’s result.
  • 16. mysql functions:1.rand()desc: returns random values2.sum()desc: returns the sum of the values.3.now()desc: returns the time and date of the system.4.count()desc: returns the count of the values which satisfy the given condition.
  • 17. sample code to create a table employee and run basic queries using mysql on windows operating system:Mysql>create table employee(Ssn INT NOT NULL,Salary INT,Name VARCHAR(20)Department VARCHAR(20),Primary key(ssn));Query ok, 0 rows affected (0.04 sec)
  • 18. Mysql>insert into employeeValues(100,10000,’sneha’,’finance’);Query ok, 1 row affected(0.04 sec)Mysql>insert into employeeValues(200,20000,’shalini’,’hr’);Query ok, 1 row affected(0.04 sec)
  • 19. Mysql>insert into employeeValues(300,30000,’john’,’finance’);Query ok, 1 row affected(0.04 sec)Mysql>insert into employeeValues(400,40000,’jack’,’hr’);Query ok, 1 row affected(0.04 sec)
  • 21. Mysql>select department, count(*) as number from employee group by department order by number desc;
  • 24. Mysql> select name, ssn from employee order by ssn desc limit 2;
  • 25. Mysql>update employee set salary=9000 where ssn=400;Mysql>select * from employee;
  • 26. Mysql>delete from employeewhere name=‘jack’;mysql>select * from employee;
  • 27. Mysql>drop table employee;query ok, 0 rows affected (0.04 sec)Mysql>select * from employee;ERROR 1146 (42S02): Table ‘mysql.employee’ doesn’t existuse quit or exit to come out of mysql.Mysql>quit
  • 28. Advantages of mysql:1.Its most reliable.2.Easy to use.3.Very fast.4.Multithreadedmulti-user and5.Robust sqldatabase server.
  • 29. Visit more self help tutorialsPick a tutorial of your choice and browse through it at your own pace.The tutorials section is free, self-guiding and will not involve any additional support.Visit us at www.dataminingtools.net