SlideShare a Scribd company logo
MY SQL INSTALLATION AND  CONFIGERATION WITH QUERY BY , R.RAJAVEL (MAGNA COLLEGE OF ENGINEERING)
INTRODUCTION: MySQL, the most popular Open Source SQL database management system,  is developed, distributed, and supported by MySQL AB.  MySQL AB is a commercial company, founded by the MySQL developers.  It is a second generation Open Source company that unites  Open Source values and methodology with a successful business model.
MySQL is a fast, stable and true multi-user,  multi-threaded SQL database server.  SQL (Structured Query Language) is the most popular  database query language in the world.  The main goals of MySQL are speed, robustness and ease of use.
Installing MySQL on Linux It's simple to install MySQL on Linux using the RPM file. 1. Become the superuser if you are working in your account.  (Type "su" and the prompt and give the root password). 2. Change to the directory that has the RPM download. 3. Type the following command at the prompt: rpm -ivh "mysql_file_name.rpm" Similarly you can also install the MySQL client and MySQL development RPMs  if you've downloaded them. Alternatively, you can install the RPMs through GnoRPM (found under System).
You can check your configuration using the following command #netstat -tap Output Looks like below tcp 0 0 *:mysql *:* LISTEN 4997/mysqld MySQL comes with no root password as default.  This is a huge security risk. You’ll need to set one. So that the local computer gets root access as well, you’ll need to set a password for that too.  The local-machine-name is the name of the  KonaLink1KonaLink1computer  you’re working on.  For more information see here #mysqladmin -u root password your-new-password #mysqladmin -h root@local-machine-name -u root -p password your-new-password #/etc/init.d/mysql restart
4. Now we'll set a password for the root user. Issue the following at the prompt. mysqladmin -u root password mysqldata where mysqldata is the password for the root. (Change this to anything you like). 5. It is now time to test the programs. Typing the following at the prompt starts the mysql client program. mysql -u root -p The system asks for the the password. Type the root password (mysqldata). If you don't get the prompt for password, it might be because MySQL Server is not running.  To start the server, change to /etc/rc.d/init.d/ directory and issue the command ./mysql start  (or mysql start depending on the value of the PATH variable on your system).  Now invoke mysql client program.
6. Once MySQL client is running, you should get the mysql> prompt. Type the following at this prompt: show databases; 7. You should now get a display similar to: +----------------+ | Database  | +----------------+ | mysql  | | test  | +----------------+ 2 rows in set (0.00 sec)
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Frequently this registration process is done by the editing  of a special application-specific configuration file either  via a Web GUI or from the command line. Read your application's installation guide for details.  You should always remember that MySQL is just a database that your application  will use to store information.  The application may be written in a variety of languages with Perl and PHP being the most popular. The base PHP and Perl RPMs are installed with Fedora Linux by default,  but the packages used by these languages to talk to MySQL are not.  You should also ensure that you install the RPMs listed in Table 34.1 on your MySQL clients to ensure compatibility. Use the yum utility discussed in Chapter 6, " Installing Linux Software ",  if you are uncertain of the prerequisite RPMs needed.
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
BASIC MySQL COMMAND * CREATE TABLE syntax * DROP TABLE syntax * DELETE syntax  * SELECT syntax  * JOIN syntax  * INSERT syntax  * REPLACE syntax  * UPDATE syntax
BASIC QURIES CREATE TABLE This command is used to create structure of the table. Syntax : Create table <tablename>(list of col  Definition1,....); Example: Create table emp1 (Emp ID (number(3)  primary key, Name(varchar(20), Age(number(),  DOB(date));
DROP TABLE Syntax: Drop table [if exists]  tbl_name Explanation:   DROP TABLE removes one or more tables. All table data and the table definition are removed.You can use the keywords IF EXISTS to prevent an error from  occurring for tables that don't exist.
DELETE Syntax: Delete from <tablename>; Example: Delete from emp1; Explanation: This command is used to delete the rows and column.
SELECT Syntax: Select * from <tablename>; Example: Select * from emp1; Explanation: This command is used to describe the structure of the table.
INSERT VALUE Syntax: Insert into <tablename> values (list of values); Example: Insert into emp1 values (11, Anu, 20,30-aug-1989); Explanation: This command is used to insert values into the structure of the table.
REPLACE   Syntax: REPLACE  [INTO] tbl_name [(col_name,...)] VALUES (expression,...) Explanation:   REPLACE works exactly like INSERT, except that if an old record in the table has the same value as a new record on a unique index, the old record is  deleted before the new record is inserted.
UPDATE Syntax: UPDATE [table] SET [column]=[value] WHERE [criteria]  UPDATE Used_Vehicles SET mileage=66000 WHERE vehicle_id=1;  UPDATE [table] SET [column]=[value] WHERE [criteria]  Example: UPDATE Used_Vehicles SET mileage=66000 WHERE vehicle_id=1;  Explanation:  UPDATE updates columns in existing table rows with new values. The SET clause indicates which columns to modify and the values they should be given. The WHERE clause, if given, specifies which rows should be updated. Otherwise all rows are updated.
ADVANCED COMMANDS ,[object Object],[object Object],[object Object],[object Object],[object Object]
AS Syntax: SELECT <columns>FROM <existing_table_name>AS <new_table_name> Example:  SELECT t1.name -> FROM artists -> AS t1;  Explanation:  It is used to create a shorthand reference to elements with long names to make the SQL statements shorter and reduce the chance of typos in the longer names.
ALTERING THE DATABASE STRUCTURE AND  ADDING DATA Syntax: ALATER TABLE tablename ADD clm_name type Example:   ALTER TABLE cds  ->  ADD producerID INT(3);
UNION JOINS Syntax:  Select <fields>from <table> where <condition> union SELECT <fields>  FROM <table>WHERE <condition> Example:  SELECT artist FROM artists WHERE (artists.name LIKE 'P%')  UNION SELECT artists.name FROM artists WHERE (artists.name LIKE 'G%'); Explanation:  Union Joins allow the results of two queries to be combined into one outputted result set. This is done by having the 2 (or more) queries glued together by the UNION operator.
CREATING THE TEMPORARY TABLE Definition:  The syntax for creating temporary tables is almost identical that used for creating a normal table. Except that there is an extra TEMPORARY clause.  Syntax:  CREATE TEMPORARY TABLE <table> (field definition)  CREATE TEMPORARY TABLE <newtable>SELECT * FROM <oldtable>
TRUNCATE TABLE Syntax:  TRUNCATE TABLE <table_name> Example:  TRUNCATE TABLE emp1;
TRUNCATE( ) Syntax:  TRUNCATE(X,D) Use:  This function is used to return the value of X truncated to D number of decimal places.
INSERT( ) Syntax:  INSERT(str,pos,len,newstr) Use:  Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr.
SQL Constraints: Constraints are used to limit the type of data that can go into a table. Constraints can be specified when a table is created (with the CREATE TABLE statement) or after the table is created (with the ALTER TABLE statement). We will focus on the following constraints: NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY CHECK DEFAULT
The TOP Clause The TOP clause is used to specify the number of records to return. The TOP clause can be very useful on large tables with thousands of records. Returning a large number of records can impact on performance. Note: Not all database systems support the TOP clause. SQL Server Syntax SELECT TOP number|percent column_name(s) FROM table_name examble: SELECT TOP 2 * FROM Persons  P_Id  LastName  FirstName  Address  City 1  HansenOla  Timoteivn  10  Sandnes 2  Svendson  ToveBorgvn  23  Sandnes
The LIKE Operator The LIKE operator is used to search for a specified pattern in a column. SQL LIKE Syntax SELECT column_name(s) FROM table_name WHERE column_name LIKE pattern EXAMPLE: SELECT * FROM Persons WHERE City LIKE 's%' P_Id  LastName  FirstName  Address  City 1  Hansen  Ola  Timoteivn  10
To export a database, use the mysqldump utility normally located in your mysql/bin directory . For example, to export all the tables and data for a database named guestdb. Syntax: mysqldump guestdb > guestdb.txt Exporting a Database
This will create a text file containing all the commands necessary to recreate all the tables and data found in guestdb. However, what if I want to export only one table? To do this the command is modified as follows assuming guestTbl is the table to be exported. Syntax: mysqldump guestdb guestTbl > guestdb.txt
With the data in a text file, its time to import the data back into MySQL. This can be done by passing the commands contained in the text file into the MySQL client.  For example: mysql -p --user=username < guestdb.txt This passes all the commands in the file into the mysql client just like you were typing them in. Importing the Database

More Related Content

What's hot

Oracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guideOracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guide
Raviteja Chowdary Adusumalli
 
DBMS lab manual
DBMS lab manualDBMS lab manual
DBMS lab manualmaha tce
 
Dbms lab Manual
Dbms lab ManualDbms lab Manual
Dbms lab Manual
Vivek Kumar Sinha
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
Ram Sagar Mourya
 
My sql with querys
My sql with querysMy sql with querys
My sql with querysNIRMAL FELIX
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
paddu123
 
DDL,DML,SQL Functions and Joins
DDL,DML,SQL Functions and JoinsDDL,DML,SQL Functions and Joins
DDL,DML,SQL Functions and JoinsAshwin Dinoriya
 
Lab
LabLab
Oracle: DDL
Oracle: DDLOracle: DDL
Oracle: DDL
DataminingTools Inc
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
HudaRaghibKadhim
 
Beginner guide to mysql command line
Beginner guide to mysql command lineBeginner guide to mysql command line
Beginner guide to mysql command line
Priti Solanki
 

What's hot (16)

Les11 Including Constraints
Les11 Including ConstraintsLes11 Including Constraints
Les11 Including Constraints
 
Oracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guideOracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guide
 
DBMS lab manual
DBMS lab manualDBMS lab manual
DBMS lab manual
 
Dbms lab Manual
Dbms lab ManualDbms lab Manual
Dbms lab Manual
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
Les10 Creating And Managing Tables
Les10 Creating And Managing TablesLes10 Creating And Managing Tables
Les10 Creating And Managing Tables
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
DDL,DML,SQL Functions and Joins
DDL,DML,SQL Functions and JoinsDDL,DML,SQL Functions and Joins
DDL,DML,SQL Functions and Joins
 
Lab
LabLab
Lab
 
Oracle: DDL
Oracle: DDLOracle: DDL
Oracle: DDL
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
Oracle sql material
Oracle sql materialOracle sql material
Oracle sql material
 
Beginner guide to mysql command line
Beginner guide to mysql command lineBeginner guide to mysql command line
Beginner guide to mysql command line
 

Viewers also liked

Introducing Modern Perl
Introducing Modern PerlIntroducing Modern Perl
Introducing Modern PerlDave Cross
 
Apress.html5.and.java script.projects.oct.2011
Apress.html5.and.java script.projects.oct.2011Apress.html5.and.java script.projects.oct.2011
Apress.html5.and.java script.projects.oct.2011Samuel K. Itotia
 
perl usage at database applications
perl usage at database applicationsperl usage at database applications
perl usage at database applicationsJoe Jiang
 
Dbi Advanced Talk 200708
Dbi Advanced Talk 200708Dbi Advanced Talk 200708
Dbi Advanced Talk 200708oscon2007
 
working with database using mysql
working with database using mysql working with database using mysql
working with database using mysql
Subhasis Nayak
 
High Availability Perl DBI + MySQL
High Availability Perl DBI + MySQLHigh Availability Perl DBI + MySQL
High Availability Perl DBI + MySQL
Steve Purkis
 
My sql presentation
My sql presentationMy sql presentation
My sql presentationNikhil Jain
 
Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in Perl
Laurent Dami
 
Sql presentation 1 by chandan
Sql presentation 1 by chandanSql presentation 1 by chandan
Sql presentation 1 by chandan
Linux international training Center
 
Database Programming with Perl and DBIx::Class
Database Programming with Perl and DBIx::ClassDatabase Programming with Perl and DBIx::Class
Database Programming with Perl and DBIx::ClassDave Cross
 
MySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs AcademyMySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs Academy
thewebsacademy
 
Perl Introduction
Perl IntroductionPerl Introduction
Perl Introduction
Marcos Rebelo
 
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Rohan Byanjankar
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
Giuseppe Maxia
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
Tushar Chauhan
 
Unix Programming with Perl
Unix Programming with PerlUnix Programming with Perl
Unix Programming with PerlKazuho Oku
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer
 

Viewers also liked (20)

Introducing Modern Perl
Introducing Modern PerlIntroducing Modern Perl
Introducing Modern Perl
 
Apress.html5.and.java script.projects.oct.2011
Apress.html5.and.java script.projects.oct.2011Apress.html5.and.java script.projects.oct.2011
Apress.html5.and.java script.projects.oct.2011
 
perl usage at database applications
perl usage at database applicationsperl usage at database applications
perl usage at database applications
 
Dbi Advanced Talk 200708
Dbi Advanced Talk 200708Dbi Advanced Talk 200708
Dbi Advanced Talk 200708
 
working with database using mysql
working with database using mysql working with database using mysql
working with database using mysql
 
High Availability Perl DBI + MySQL
High Availability Perl DBI + MySQLHigh Availability Perl DBI + MySQL
High Availability Perl DBI + MySQL
 
My sql presentation
My sql presentationMy sql presentation
My sql presentation
 
Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in Perl
 
Sql presentation 1 by chandan
Sql presentation 1 by chandanSql presentation 1 by chandan
Sql presentation 1 by chandan
 
Database Programming with Perl and DBIx::Class
Database Programming with Perl and DBIx::ClassDatabase Programming with Perl and DBIx::Class
Database Programming with Perl and DBIx::Class
 
MySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs AcademyMySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs Academy
 
Perl Introduction
Perl IntroductionPerl Introduction
Perl Introduction
 
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
 
Trigger
TriggerTrigger
Trigger
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Unix Programming with Perl
Unix Programming with PerlUnix Programming with Perl
Unix Programming with Perl
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
 

Similar to My sql.ppt

MYSQL
MYSQLMYSQL
MYSQLARJUN
 
Mysqlppt
MysqlpptMysqlppt
MysqlpptReka
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql SyntaxReka
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
paddu123
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinhwebhostingguy
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
Abrar ali
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standardsAlessandro Baratella
 
MySQL Presentation
MySQL PresentationMySQL Presentation
MySQL Presentation
Manish Bothra
 
Dbms
DbmsDbms
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
metsarin
 
Using Mysql.pptx
Using Mysql.pptxUsing Mysql.pptx
Using Mysql.pptx
StephenEfange3
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
ChryslerPanaguiton
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
ChryslerPanaguiton
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
Bwsrang Basumatary
 

Similar to My sql.ppt (20)

MYSQL
MYSQLMYSQL
MYSQL
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Mysql
MysqlMysql
Mysql
 
Raj mysql
Raj mysqlRaj mysql
Raj mysql
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql Syntax
 
My sql
My sqlMy sql
My sql
 
Sah
SahSah
Sah
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
 
MySQL Presentation
MySQL PresentationMySQL Presentation
MySQL Presentation
 
Dbms
DbmsDbms
Dbms
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
Using Mysql.pptx
Using Mysql.pptxUsing Mysql.pptx
Using Mysql.pptx
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
 

More from MAGNA COLLEGE OF ENGINEERING (7)

Ajax.ppt
Ajax.pptAjax.ppt
Ajax.ppt
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Css
CssCss
Css
 
Appache.ppt
Appache.pptAppache.ppt
Appache.ppt
 
Htmltag.ppt
Htmltag.pptHtmltag.ppt
Htmltag.ppt
 
Rajavel resume
Rajavel  resumeRajavel  resume
Rajavel resume
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 

My sql.ppt

  • 1. MY SQL INSTALLATION AND CONFIGERATION WITH QUERY BY , R.RAJAVEL (MAGNA COLLEGE OF ENGINEERING)
  • 2. INTRODUCTION: MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by MySQL AB. MySQL AB is a commercial company, founded by the MySQL developers. It is a second generation Open Source company that unites Open Source values and methodology with a successful business model.
  • 3. MySQL is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query language in the world. The main goals of MySQL are speed, robustness and ease of use.
  • 4. Installing MySQL on Linux It's simple to install MySQL on Linux using the RPM file. 1. Become the superuser if you are working in your account. (Type &quot;su&quot; and the prompt and give the root password). 2. Change to the directory that has the RPM download. 3. Type the following command at the prompt: rpm -ivh &quot;mysql_file_name.rpm&quot; Similarly you can also install the MySQL client and MySQL development RPMs if you've downloaded them. Alternatively, you can install the RPMs through GnoRPM (found under System).
  • 5. You can check your configuration using the following command #netstat -tap Output Looks like below tcp 0 0 *:mysql *:* LISTEN 4997/mysqld MySQL comes with no root password as default. This is a huge security risk. You’ll need to set one. So that the local computer gets root access as well, you’ll need to set a password for that too. The local-machine-name is the name of the KonaLink1KonaLink1computer you’re working on. For more information see here #mysqladmin -u root password your-new-password #mysqladmin -h root@local-machine-name -u root -p password your-new-password #/etc/init.d/mysql restart
  • 6. 4. Now we'll set a password for the root user. Issue the following at the prompt. mysqladmin -u root password mysqldata where mysqldata is the password for the root. (Change this to anything you like). 5. It is now time to test the programs. Typing the following at the prompt starts the mysql client program. mysql -u root -p The system asks for the the password. Type the root password (mysqldata). If you don't get the prompt for password, it might be because MySQL Server is not running. To start the server, change to /etc/rc.d/init.d/ directory and issue the command ./mysql start (or mysql start depending on the value of the PATH variable on your system). Now invoke mysql client program.
  • 7. 6. Once MySQL client is running, you should get the mysql> prompt. Type the following at this prompt: show databases; 7. You should now get a display similar to: +----------------+ | Database | +----------------+ | mysql | | test | +----------------+ 2 rows in set (0.00 sec)
  • 8.
  • 9. Frequently this registration process is done by the editing of a special application-specific configuration file either via a Web GUI or from the command line. Read your application's installation guide for details. You should always remember that MySQL is just a database that your application will use to store information. The application may be written in a variety of languages with Perl and PHP being the most popular. The base PHP and Perl RPMs are installed with Fedora Linux by default, but the packages used by these languages to talk to MySQL are not. You should also ensure that you install the RPMs listed in Table 34.1 on your MySQL clients to ensure compatibility. Use the yum utility discussed in Chapter 6, &quot; Installing Linux Software &quot;, if you are uncertain of the prerequisite RPMs needed.
  • 10.
  • 11. BASIC MySQL COMMAND * CREATE TABLE syntax * DROP TABLE syntax * DELETE syntax * SELECT syntax * JOIN syntax * INSERT syntax * REPLACE syntax * UPDATE syntax
  • 12. BASIC QURIES CREATE TABLE This command is used to create structure of the table. Syntax : Create table <tablename>(list of col Definition1,....); Example: Create table emp1 (Emp ID (number(3) primary key, Name(varchar(20), Age(number(), DOB(date));
  • 13. DROP TABLE Syntax: Drop table [if exists] tbl_name Explanation: DROP TABLE removes one or more tables. All table data and the table definition are removed.You can use the keywords IF EXISTS to prevent an error from occurring for tables that don't exist.
  • 14. DELETE Syntax: Delete from <tablename>; Example: Delete from emp1; Explanation: This command is used to delete the rows and column.
  • 15. SELECT Syntax: Select * from <tablename>; Example: Select * from emp1; Explanation: This command is used to describe the structure of the table.
  • 16. INSERT VALUE Syntax: Insert into <tablename> values (list of values); Example: Insert into emp1 values (11, Anu, 20,30-aug-1989); Explanation: This command is used to insert values into the structure of the table.
  • 17. REPLACE Syntax: REPLACE [INTO] tbl_name [(col_name,...)] VALUES (expression,...) Explanation: REPLACE works exactly like INSERT, except that if an old record in the table has the same value as a new record on a unique index, the old record is deleted before the new record is inserted.
  • 18. UPDATE Syntax: UPDATE [table] SET [column]=[value] WHERE [criteria] UPDATE Used_Vehicles SET mileage=66000 WHERE vehicle_id=1; UPDATE [table] SET [column]=[value] WHERE [criteria] Example: UPDATE Used_Vehicles SET mileage=66000 WHERE vehicle_id=1; Explanation: UPDATE updates columns in existing table rows with new values. The SET clause indicates which columns to modify and the values they should be given. The WHERE clause, if given, specifies which rows should be updated. Otherwise all rows are updated.
  • 19.
  • 20. AS Syntax: SELECT <columns>FROM <existing_table_name>AS <new_table_name> Example: SELECT t1.name -> FROM artists -> AS t1; Explanation: It is used to create a shorthand reference to elements with long names to make the SQL statements shorter and reduce the chance of typos in the longer names.
  • 21. ALTERING THE DATABASE STRUCTURE AND ADDING DATA Syntax: ALATER TABLE tablename ADD clm_name type Example: ALTER TABLE cds -> ADD producerID INT(3);
  • 22. UNION JOINS Syntax: Select <fields>from <table> where <condition> union SELECT <fields> FROM <table>WHERE <condition> Example: SELECT artist FROM artists WHERE (artists.name LIKE 'P%') UNION SELECT artists.name FROM artists WHERE (artists.name LIKE 'G%'); Explanation: Union Joins allow the results of two queries to be combined into one outputted result set. This is done by having the 2 (or more) queries glued together by the UNION operator.
  • 23. CREATING THE TEMPORARY TABLE Definition: The syntax for creating temporary tables is almost identical that used for creating a normal table. Except that there is an extra TEMPORARY clause. Syntax: CREATE TEMPORARY TABLE <table> (field definition) CREATE TEMPORARY TABLE <newtable>SELECT * FROM <oldtable>
  • 24. TRUNCATE TABLE Syntax: TRUNCATE TABLE <table_name> Example: TRUNCATE TABLE emp1;
  • 25. TRUNCATE( ) Syntax: TRUNCATE(X,D) Use: This function is used to return the value of X truncated to D number of decimal places.
  • 26. INSERT( ) Syntax: INSERT(str,pos,len,newstr) Use: Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr.
  • 27. SQL Constraints: Constraints are used to limit the type of data that can go into a table. Constraints can be specified when a table is created (with the CREATE TABLE statement) or after the table is created (with the ALTER TABLE statement). We will focus on the following constraints: NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY CHECK DEFAULT
  • 28. The TOP Clause The TOP clause is used to specify the number of records to return. The TOP clause can be very useful on large tables with thousands of records. Returning a large number of records can impact on performance. Note: Not all database systems support the TOP clause. SQL Server Syntax SELECT TOP number|percent column_name(s) FROM table_name examble: SELECT TOP 2 * FROM Persons P_Id LastName FirstName Address City 1 HansenOla Timoteivn 10 Sandnes 2 Svendson ToveBorgvn 23 Sandnes
  • 29. The LIKE Operator The LIKE operator is used to search for a specified pattern in a column. SQL LIKE Syntax SELECT column_name(s) FROM table_name WHERE column_name LIKE pattern EXAMPLE: SELECT * FROM Persons WHERE City LIKE 's%' P_Id LastName FirstName Address City 1 Hansen Ola Timoteivn 10
  • 30. To export a database, use the mysqldump utility normally located in your mysql/bin directory . For example, to export all the tables and data for a database named guestdb. Syntax: mysqldump guestdb > guestdb.txt Exporting a Database
  • 31. This will create a text file containing all the commands necessary to recreate all the tables and data found in guestdb. However, what if I want to export only one table? To do this the command is modified as follows assuming guestTbl is the table to be exported. Syntax: mysqldump guestdb guestTbl > guestdb.txt
  • 32. With the data in a text file, its time to import the data back into MySQL. This can be done by passing the commands contained in the text file into the MySQL client. For example: mysql -p --user=username < guestdb.txt This passes all the commands in the file into the mysql client just like you were typing them in. Importing the Database