SlideShare a Scribd company logo
A PRESENTATION  ON MYSQL - BY MANISH  BOTHRA
MYSQL INSTALLATION COMMANDS
Installing MySQL on Windows Introduction Introduction Installing MySQL Running MySQL Testing with PHP Presented by Mike Barras, ITS Available online at
Installing MySQL on Windows Introduction Supported 32-bit Windows Platforms (Win32)  Windows 9x (95/98/ME) Windows NT (NT/2000/XP) Workstation/Home/Professional Server Editions
Installing MySQL on Windows Installing MySQL Example environment Windows 2000 Server (SP 3) IIS 5.0 PHP 4.3.1 MySQL 4.0.12 Note: IIS (Web Server) and PHP (Script engine) are  NOT required to install or run MySQL.
Installing MySQL on Windows Installing MySQL Step 1: Download the most recent version of the MySQL for  Windows installer from  http://www.mysql.org/ , and run it. Select the directory to which you would  like to install MySQL (c:\mysql).
Installing MySQL on Windows Installing MySQL Step 2: Select the setup type that you would like to use. The  “ typical” should be sufficient for just about everybody. It  installs all items, including: The Mysql Servers Clients and maint. tools Documentation Examples and Libraries Grants tables and core files
Installing MySQL on Windows Installing MySQL Step 3: That’s it! Click finish and you’re done installing (it really is just that simple)
Installing MySQL on Windows Running MySQL You must manually start MySQL the first time. c:\mysql\bin\winmysqladmin.exe You will be prompted to create an admin username and  Password. This is the login information for the admin tool, not any specific database or table. Once the admin account is created, the server will be running (either as a program in Win 9x or as a service in NT) and will  run each time you start Windows. The “traffic light” system tray icon shows you its working.
Installing MySQL on Windows Running MySQL Run the MySQL command interface by executing  c:\mysql\bin\mysql.exe Type  show databases;  to See the current databases Configured on the server. By default, “mysql” and “ test” should be there. Type  use test;  to specify that database.
Installing MySQL on Windows Running MySQL Let’s create a table.  Type  show tables;  to see Currently defined tables in “ test”. Issue create table command to create a table. Now run  show tables;  again to  verify what you’ve done. create table  tablename  ( column datatype );
Installing MySQL on Windows Running MySQL Insert some data into the  table you’ve just created using the “insert into” SQL command. Verify the insert by “selecting” the information back out. insert into  tablename  ( field1, field2,… ) values ( value1, value2,… ); select [list of fieldnames or *] from  tablename;
Installing MySQL on Windows Testing with PHP The true measure of success (requires PHP and web server) Put it all together. PHP Functions: mysql_connect( host[,user,pass] ) mysql_select_db( database ) mysql_query( SQL stmt ); mysql_close( database handle );
Installing MySQL on Windows Testing with PHP
Installing PHP on Windows Useful Links This Presentation http:// uts.cc.utexas.edu/~mpbarras/php / Download MySQL http://www.mysql.com/downloads/mysql-4.0.html Installation Documentation  http://www.mysql.com/documentation/index.html PHP reference for MySQL functions http://www.php.net/manual/en/ref.mysql.php
BASIC SQL COMMANDS SQL STATEMENTS: T here are a number of SQL statements, few of which are explained below: Data Retrieval Statement:  SELECT is the data extracting statement which retrieves the data from the database. Data Manipulation Language (DML):  This language constitutes the statements that are used to manipulate with the data. It has three commands, which are INSERT, UPDATE and DELETE.  Data Definition Language (DDL):  This is the language used to define the tables. It sets up, changes, and removes data structures from the tables. It uses 5 commands, which are CREATE, ALTER, DROP, RENAME and TRUNCATE.
CREATING A TABLE Syntax: Create table <Table Name>  ( <Field1>  <Type> <(width)>  [Not Null/Null], <Field2>  <Type> <(width)>  [Not Null/Null], ..................................) : Example: Create table student_table (Reg_No Text (6) Name Text (25), Class Text (5));
CREATING A TABLE WITH PRIMARY KEY Syntax: Create table <Table Name>  ( <Field1>  <Type> <(width)>  Constraint <constraint name> Primary Key , <Field2>  <Type> <(width)>, ..................................) :   Example: a) Create table student_table2 (Reg_no Text (4) Constraint  student_Reg_pk primary key, Name Text (25), Class Text (5));
CREATING A TABLE WITH COMPOSITE PK Syntax: Create table <Table Name>  ( <Field1>  <Type> <(width)> , <Field2>  <Type> <(width)>, ..................................<field-n> <type-n> <width-n>,  Constraint <constraint-name> Primary Key (Field1, Field2)) :  Example: Create table student_table3 (Reg_no Text (4), Name Text (25), Class Text (5), Constraint  student_Reg_Class_pk primary key (Reg_no, Class));  
CREATING A TABLE WITH FOREIGN KEY Create table student_table2 (Reg_no Text (4),  Name Text (25), Class Text (5) Proj_No Text (4) Constraint  student_Reg_pk primary key (Reg_no) Constraint project_PNo_fk Foreign Key (Proj_No) References Project (Proj_No));
To Delete a Table along with all contents Syntax: Drop Table <Table-Name>; Example:   Drop Table student_table2;
To Add a field to the table (structure) Syntax: Alter Table <Table-Name> Add <Field Name> <Type> (width); Example: Alter Table Student_Table Add Roll_no Text (4);
To Insert Data Into a Table a)  Syntax: Insert Into <Table-Name> (Fieldname1, Fieldname2, Fieldname3,..) Values (value1, value2, value3,..) Example: Insert Into Student_Table (Reg_no, Name, class) Values (1211, &quot;Umar&quot;, &quot;MCS&quot;); ;
Example: b-1)  Insert Into Student_Table  Values (1123, &quot;Babar&quot;, null, null); b-2)  Insert Into Student_Table (Reg_no, Name, class, Roll_no) Values (1124, &quot;Babar&quot;, null, null); b-3)  Insert Into Student_Table (Reg_no, Name) Values (1124, &quot;Babar&quot;); b)  Syntax: Insert Into <Table-Name>  Values (value1, value2, value3,.., value-n);
To Delete a Row or Rows (Records) Syntax: Delete from <table name> [where <condition>]; Example: a) Delete from student_table;  (it will delete al the records from student table).   b) Delete from student_table    (conditional deletion) Where class=&quot;MCS&quot;;
Modifying (Updating) Records: Syntax: UPDATE <table name> Set <Field Name> = <Value> Where <Condition>;   Example: a) UPDATE Student Set Semester = 5  where Semester = 4 or Class = “MCS”; b) UPDATE Student Set Semester = 5, Class = “MS” where Semester = 4 or Class = “MCS”;
Creating a View: Syntax: CREATE VIEW <View-Name> AS Select Field1, Field2, Field3 From <Table_Name> Example: CREATE VIEW Student_BCS as Select Reg_No, Name, Class From Student Where Class = “BCS”;  
Querying a View: Syntax: Select <Field List> From <View Name> Where <condition>; Example: a) Select * From Student_BCS ; b) Select * From Student_BCS where City = “Islamabad”;
Retrieving (Displaying) Data: Syntax: Select <field1, field2, ……fieldn>  from <table name> where <condition>; Example:  a)  SELECT * FROM Student_table;   b)  SELECT Reg_no, Name FROM Student_table;
Retrieving (Displaying) Data depending on some condition: Syntax: Select <field1, field2, ……fieldn>  from <table name> Where <Condition>; Example: a) Select *  From Student_table Where class= &quot;BCS&quot;;   b) Select Name, Reg_no  From Student_table Where class= &quot;BCS&quot;;
THANK YOU
 
Ad

More Related Content

What's hot (20)

Last train to php 7
Last train to php 7Last train to php 7
Last train to php 7
Damien Seguy
 
Php ppt
Php pptPhp ppt
Php ppt
Sanmuga Nathan
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
Alan Pinstein
 
php
phpphp
php
ajeetjhajharia
 
Php Ppt
Php PptPhp Ppt
Php Ppt
vsnmurthy
 
Overview of PHP and MYSQL
Overview of PHP and MYSQLOverview of PHP and MYSQL
Overview of PHP and MYSQL
Deblina Chowdhury
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
Taha Malampatti
 
A History of PHP
A History of PHPA History of PHP
A History of PHP
Xinchen Hui
 
PHP presentation - Com 585
PHP presentation - Com 585PHP presentation - Com 585
PHP presentation - Com 585
jstout007
 
Introduction to php web programming - get and post
Introduction to php  web programming - get and postIntroduction to php  web programming - get and post
Introduction to php web programming - get and post
baabtra.com - No. 1 supplier of quality freshers
 
Php intro
Php introPhp intro
Php intro
sana mateen
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
krutitrivedi
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
Karmatechnologies Pvt. Ltd.
 
PHP in one presentation
PHP in one presentationPHP in one presentation
PHP in one presentation
Milad Rahimi
 
01 Php Introduction
01 Php Introduction01 Php Introduction
01 Php Introduction
Geshan Manandhar
 
PHP - History, Introduction, Summary, Extensions and Frameworks
PHP - History, Introduction, Summary, Extensions and FrameworksPHP - History, Introduction, Summary, Extensions and Frameworks
PHP - History, Introduction, Summary, Extensions and Frameworks
Royston Olivera
 
Advantages of Choosing PHP Web Development
Advantages of Choosing PHP Web DevelopmentAdvantages of Choosing PHP Web Development
Advantages of Choosing PHP Web Development
Grey Matter India Technologies PVT LTD
 
Software Design
Software DesignSoftware Design
Software Design
Spy Seat
 
Securing Your Web Server
Securing Your Web ServerSecuring Your Web Server
Securing Your Web Server
manugoel2003
 
PHP complete reference with database concepts for beginners
PHP complete reference with database concepts for beginnersPHP complete reference with database concepts for beginners
PHP complete reference with database concepts for beginners
Mohammed Mushtaq Ahmed
 

Similar to MySQL Presentation (20)

MySQL
MySQLMySQL
MySQL
Gouthaman V
 
mysql-win.ppt
mysql-win.pptmysql-win.ppt
mysql-win.ppt
webhostingguy
 
My SQl
My SQlMy SQl
My SQl
Ramasubbu .P
 
Raj mysql
Raj mysqlRaj mysql
Raj mysql
firstplanet
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
webhostingguy
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
NIRMAL FELIX
 
mysqlHiep.ppt
mysqlHiep.pptmysqlHiep.ppt
mysqlHiep.ppt
webhostingguy
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
webhostingguy
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
MAGNA COLLEGE OF ENGINEERING
 
Based on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docxBased on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docx
JASS44
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
Bwsrang Basumatary
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
pradnyamulay
 
Php classes in mumbai
Php classes in mumbaiPhp classes in mumbai
Php classes in mumbai
aadi Surve
 
PHP - Intriduction to MySQL And PHP
PHP - Intriduction to MySQL And PHPPHP - Intriduction to MySQL And PHP
PHP - Intriduction to MySQL And PHP
Vibrant Technologies & Computers
 
MYSQL
MYSQLMYSQL
MYSQL
ARJUN
 
Complete SQL in one video by shradha.pdf
Complete SQL in one video by shradha.pdfComplete SQL in one video by shradha.pdf
Complete SQL in one video by shradha.pdf
rahulashu699
 
Using Mysql.pptx
Using Mysql.pptxUsing Mysql.pptx
Using Mysql.pptx
StephenEfange3
 
MySql:Basics
MySql:BasicsMySql:Basics
MySql:Basics
DataminingTools Inc
 
MySQL Basics
MySQL BasicsMySQL Basics
MySQL Basics
mysql content
 
Mysqlppt3510
Mysqlppt3510Mysqlppt3510
Mysqlppt3510
Khan Rahimeen
 
Ad

Recently uploaded (20)

Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Ad

MySQL Presentation

  • 1. A PRESENTATION ON MYSQL - BY MANISH BOTHRA
  • 3. Installing MySQL on Windows Introduction Introduction Installing MySQL Running MySQL Testing with PHP Presented by Mike Barras, ITS Available online at
  • 4. Installing MySQL on Windows Introduction Supported 32-bit Windows Platforms (Win32) Windows 9x (95/98/ME) Windows NT (NT/2000/XP) Workstation/Home/Professional Server Editions
  • 5. Installing MySQL on Windows Installing MySQL Example environment Windows 2000 Server (SP 3) IIS 5.0 PHP 4.3.1 MySQL 4.0.12 Note: IIS (Web Server) and PHP (Script engine) are NOT required to install or run MySQL.
  • 6. Installing MySQL on Windows Installing MySQL Step 1: Download the most recent version of the MySQL for Windows installer from http://www.mysql.org/ , and run it. Select the directory to which you would like to install MySQL (c:\mysql).
  • 7. Installing MySQL on Windows Installing MySQL Step 2: Select the setup type that you would like to use. The “ typical” should be sufficient for just about everybody. It installs all items, including: The Mysql Servers Clients and maint. tools Documentation Examples and Libraries Grants tables and core files
  • 8. Installing MySQL on Windows Installing MySQL Step 3: That’s it! Click finish and you’re done installing (it really is just that simple)
  • 9. Installing MySQL on Windows Running MySQL You must manually start MySQL the first time. c:\mysql\bin\winmysqladmin.exe You will be prompted to create an admin username and Password. This is the login information for the admin tool, not any specific database or table. Once the admin account is created, the server will be running (either as a program in Win 9x or as a service in NT) and will run each time you start Windows. The “traffic light” system tray icon shows you its working.
  • 10. Installing MySQL on Windows Running MySQL Run the MySQL command interface by executing c:\mysql\bin\mysql.exe Type show databases; to See the current databases Configured on the server. By default, “mysql” and “ test” should be there. Type use test; to specify that database.
  • 11. Installing MySQL on Windows Running MySQL Let’s create a table. Type show tables; to see Currently defined tables in “ test”. Issue create table command to create a table. Now run show tables; again to verify what you’ve done. create table tablename ( column datatype );
  • 12. Installing MySQL on Windows Running MySQL Insert some data into the table you’ve just created using the “insert into” SQL command. Verify the insert by “selecting” the information back out. insert into tablename ( field1, field2,… ) values ( value1, value2,… ); select [list of fieldnames or *] from tablename;
  • 13. Installing MySQL on Windows Testing with PHP The true measure of success (requires PHP and web server) Put it all together. PHP Functions: mysql_connect( host[,user,pass] ) mysql_select_db( database ) mysql_query( SQL stmt ); mysql_close( database handle );
  • 14. Installing MySQL on Windows Testing with PHP
  • 15. Installing PHP on Windows Useful Links This Presentation http:// uts.cc.utexas.edu/~mpbarras/php / Download MySQL http://www.mysql.com/downloads/mysql-4.0.html Installation Documentation http://www.mysql.com/documentation/index.html PHP reference for MySQL functions http://www.php.net/manual/en/ref.mysql.php
  • 16. BASIC SQL COMMANDS SQL STATEMENTS: T here are a number of SQL statements, few of which are explained below: Data Retrieval Statement: SELECT is the data extracting statement which retrieves the data from the database. Data Manipulation Language (DML): This language constitutes the statements that are used to manipulate with the data. It has three commands, which are INSERT, UPDATE and DELETE. Data Definition Language (DDL): This is the language used to define the tables. It sets up, changes, and removes data structures from the tables. It uses 5 commands, which are CREATE, ALTER, DROP, RENAME and TRUNCATE.
  • 17. CREATING A TABLE Syntax: Create table <Table Name> ( <Field1> <Type> <(width)> [Not Null/Null], <Field2> <Type> <(width)> [Not Null/Null], ..................................) : Example: Create table student_table (Reg_No Text (6) Name Text (25), Class Text (5));
  • 18. CREATING A TABLE WITH PRIMARY KEY Syntax: Create table <Table Name> ( <Field1> <Type> <(width)> Constraint <constraint name> Primary Key , <Field2> <Type> <(width)>, ..................................) : Example: a) Create table student_table2 (Reg_no Text (4) Constraint student_Reg_pk primary key, Name Text (25), Class Text (5));
  • 19. CREATING A TABLE WITH COMPOSITE PK Syntax: Create table <Table Name> ( <Field1> <Type> <(width)> , <Field2> <Type> <(width)>, ..................................<field-n> <type-n> <width-n>, Constraint <constraint-name> Primary Key (Field1, Field2)) : Example: Create table student_table3 (Reg_no Text (4), Name Text (25), Class Text (5), Constraint student_Reg_Class_pk primary key (Reg_no, Class));  
  • 20. CREATING A TABLE WITH FOREIGN KEY Create table student_table2 (Reg_no Text (4), Name Text (25), Class Text (5) Proj_No Text (4) Constraint student_Reg_pk primary key (Reg_no) Constraint project_PNo_fk Foreign Key (Proj_No) References Project (Proj_No));
  • 21. To Delete a Table along with all contents Syntax: Drop Table <Table-Name>; Example: Drop Table student_table2;
  • 22. To Add a field to the table (structure) Syntax: Alter Table <Table-Name> Add <Field Name> <Type> (width); Example: Alter Table Student_Table Add Roll_no Text (4);
  • 23. To Insert Data Into a Table a) Syntax: Insert Into <Table-Name> (Fieldname1, Fieldname2, Fieldname3,..) Values (value1, value2, value3,..) Example: Insert Into Student_Table (Reg_no, Name, class) Values (1211, &quot;Umar&quot;, &quot;MCS&quot;); ;
  • 24. Example: b-1) Insert Into Student_Table Values (1123, &quot;Babar&quot;, null, null); b-2) Insert Into Student_Table (Reg_no, Name, class, Roll_no) Values (1124, &quot;Babar&quot;, null, null); b-3) Insert Into Student_Table (Reg_no, Name) Values (1124, &quot;Babar&quot;); b) Syntax: Insert Into <Table-Name> Values (value1, value2, value3,.., value-n);
  • 25. To Delete a Row or Rows (Records) Syntax: Delete from <table name> [where <condition>]; Example: a) Delete from student_table; (it will delete al the records from student table).   b) Delete from student_table (conditional deletion) Where class=&quot;MCS&quot;;
  • 26. Modifying (Updating) Records: Syntax: UPDATE <table name> Set <Field Name> = <Value> Where <Condition>; Example: a) UPDATE Student Set Semester = 5 where Semester = 4 or Class = “MCS”; b) UPDATE Student Set Semester = 5, Class = “MS” where Semester = 4 or Class = “MCS”;
  • 27. Creating a View: Syntax: CREATE VIEW <View-Name> AS Select Field1, Field2, Field3 From <Table_Name> Example: CREATE VIEW Student_BCS as Select Reg_No, Name, Class From Student Where Class = “BCS”;  
  • 28. Querying a View: Syntax: Select <Field List> From <View Name> Where <condition>; Example: a) Select * From Student_BCS ; b) Select * From Student_BCS where City = “Islamabad”;
  • 29. Retrieving (Displaying) Data: Syntax: Select <field1, field2, ……fieldn> from <table name> where <condition>; Example: a) SELECT * FROM Student_table;   b) SELECT Reg_no, Name FROM Student_table;
  • 30. Retrieving (Displaying) Data depending on some condition: Syntax: Select <field1, field2, ……fieldn> from <table name> Where <Condition>; Example: a) Select * From Student_table Where class= &quot;BCS&quot;;   b) Select Name, Reg_no From Student_table Where class= &quot;BCS&quot;;
  • 32.