SlideShare a Scribd company logo
1 of 29
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 employee Values(100,10000,’sneha’,’finance’); Query ok, 1 row affected(0.04 sec) Mysql>insert into employee Values(200,20000,’shalini’,’hr’); Query ok, 1 row affected(0.04 sec)
Mysql>insert into employee Values(300,30000,’john’,’finance’); Query ok, 1 row affected(0.04 sec) Mysql>insert into employee Values(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.Multithreaded multi-user and 5.Robust sql database server.
Visit more self help tutorials Pick 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

What's hot (20)

SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
 
SQL Joins With Examples | Edureka
SQL Joins With Examples | EdurekaSQL Joins With Examples | Edureka
SQL Joins With Examples | Edureka
 
Introduction of sql server indexing
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexing
 
MySQL lecture
MySQL lectureMySQL lecture
MySQL lecture
 
Mysql joins
Mysql joinsMysql joins
Mysql joins
 
Ddl & dml commands
Ddl & dml commandsDdl & dml commands
Ddl & dml commands
 
Mysql Ppt
Mysql PptMysql Ppt
Mysql Ppt
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
 
sql function(ppt)
sql function(ppt)sql function(ppt)
sql function(ppt)
 
Inner join and outer join
Inner join and outer joinInner join and outer join
Inner join and outer join
 
MYSQL
MYSQLMYSQL
MYSQL
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
 
Mysql
MysqlMysql
Mysql
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL I
 

Viewers also liked

Mysql tutorial commands_part1
Mysql tutorial commands_part1Mysql tutorial commands_part1
Mysql tutorial commands_part1prashob7
 
A beginners guide to MariaDB
A beginners guide to MariaDBA beginners guide to MariaDB
A beginners guide to MariaDBColin Charles
 
Sql update statement
Sql update statementSql update statement
Sql update statementVivek Singh
 
MariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialColin Charles
 
Chapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemChapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemEddyzulham Mahluzydde
 
Routing and switching essentials companion guide
Routing and switching essentials companion guideRouting and switching essentials companion guide
Routing and switching essentials companion guideSiddhartha Rajbhatt
 

Viewers also liked (9)

MySQL入門介紹
MySQL入門介紹MySQL入門介紹
MySQL入門介紹
 
Mysql tutorial commands_part1
Mysql tutorial commands_part1Mysql tutorial commands_part1
Mysql tutorial commands_part1
 
A beginners guide to MariaDB
A beginners guide to MariaDBA beginners guide to MariaDB
A beginners guide to MariaDB
 
Sql update statement
Sql update statementSql update statement
Sql update statement
 
Why MariaDB?
Why MariaDB?Why MariaDB?
Why MariaDB?
 
MariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete Tutorial
 
Chapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemChapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management System
 
Ccna command
Ccna commandCcna command
Ccna command
 
Routing and switching essentials companion guide
Routing and switching essentials companion guideRouting and switching essentials companion guide
Routing and switching essentials companion guide
 

Similar to MySQL Basics

Similar to MySQL Basics (20)

Introduction databases and MYSQL
Introduction databases and MYSQLIntroduction databases and MYSQL
Introduction databases and MYSQL
 
PHP mysql Introduction database
 PHP mysql  Introduction database PHP mysql  Introduction database
PHP mysql Introduction database
 
My sql1
My sql1My sql1
My sql1
 
MySQL Presentation
MySQL PresentationMySQL Presentation
MySQL Presentation
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
 
mysqlHiep.ppt
mysqlHiep.pptmysqlHiep.ppt
mysqlHiep.ppt
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
Using Mysql.pptx
Using Mysql.pptxUsing Mysql.pptx
Using Mysql.pptx
 
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre FeaturesLinuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
 
Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2
 
Python database access
Python database accessPython database access
Python database access
 
Chapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdfChapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdf
 
MySQL with PHP
MySQL with PHPMySQL with PHP
MySQL with PHP
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
 
Mysql python
Mysql pythonMysql python
Mysql python
 
Mysql python
Mysql pythonMysql python
Mysql python
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
 
Html web sql database
Html web sql databaseHtml web sql database
Html web sql database
 
Mysql
MysqlMysql
Mysql
 

Recently uploaded

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

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 employee Values(100,10000,’sneha’,’finance’); Query ok, 1 row affected(0.04 sec) Mysql>insert into employee Values(200,20000,’shalini’,’hr’); Query ok, 1 row affected(0.04 sec)
  • 19. Mysql>insert into employee Values(300,30000,’john’,’finance’); Query ok, 1 row affected(0.04 sec) Mysql>insert into employee Values(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.Multithreaded multi-user and 5.Robust sql database server.
  • 29. Visit more self help tutorials Pick 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