SlideShare a Scribd company logo
MYSQL DEFINITION   MySQL, pronounced either "My S-Q-L" or "My Sequel," is an open source relational database management system.  It is based on the structure query language (SQL), which is used for adding, removing, and modifying information in the database.
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.
One of the more powerful features of MySQL Proxy is the ability to do &quot; Read/Write Splitting &quot;. The basic concept is to have a master database handle transactional queries while slaves handle SELECT queries. Replication is used to synchronize the changes due to transactional queries with the slaves in the cluster.
ADVANCED COMMANDS ->LTRIM ->RTRIM ->SIGN ->AS
-> ALTER and ADD
-> UNION JOIN
-> TEMPORARY Table
->TRUNCATE Table
LTRIM  The LTRIM function removes any leading (left-hand) spaces in a character string.Only leading spaces are removed—embedded and trailing spaces are left in the string.  Eg: LTRIM (' String with spaces ') Returns this string: 'String with spaces '
RTRIM The RTRIM function works like LTRIM, but it removes trailing spaces. If we need to remove both leading and trailing spaces, you can nest LTRIM and RTRIM like this: Eg:RTRIM(LTRIM (' String with spaces ')) Returns this string: 'String with spaces'
SIGN  The SIGN function takes in a numeric expression and returns one of the following values based on the sign of the input number: Return Value   Meaning − 1 Input number is negative   0 Input number is zero   1 Input number is positive Null Input number is null
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;
Functions can return string, integer, or real values and can accept arguments of those same types.
We can define simple functions that operate on a single row at a time, or aggregate functions that operate on groups of rows.
Information is provided to functions that enables them to check the number, types, and names of the arguments passed to them. FUNCTIONS
FUNCTIONS IN MYSQL Aggregate functions
Numeric functions
String functions
AGGREGATE FUNCTIONS Syntax:  SELECT COUNT(*) FROM table_name ; Use:  Mysql COUNT function is  useful in counting the number of records.
MAX AND MIN FUNCTIONS Syntax:   SELECT MAX(Col_name) FROM table_name; Use:  MySQL MAX function is used to find out the record with maximum value among a record se t.
MIN( ) Syntax:  SELECT MIN(Col_name) FROM table_name; Use:  MySQL MIN function is used to find out the record with minimum value among a record set.
AVG( ) Syntax:   SELECT AVG(Col_name) FROM table_name; Use:  MySQL AVG function is used to find out the average of a field in various records.
SUM( ) Syntax:   SELECT SUM(Col_name) FROM table_name; Use:  MySQL SUM function is used to find out the sum of a field in various records.
RAND( ) Syntax:  SELECT RAND( ); Use:  MySQL has a RAND function that can be invoked to produce random numbers between 0 and 1
NUMERIC FUNCTIONS Syntax:   ABS(X); Use:  The ABS() function returns the absolute value of X.
BIT_COUNT( ) Syntax:   BIT_COUNT(numeric_value) Use:  The BIT_COUNT() function returns the number of bits that are active in numeric_value.
CEIL( ) / CEILING( ) Syntax :  CEIL(X) CEILING(X) Use:  These function return the smallest integer value that is not smaller than X.
FLOOR( ) Syntax :    FLOOR(X) Use:  This function returns the largest integer value that is not greater than X.
LEAST( ) Syntax:  LEAST(N1,N2,N3,N4,......) Use:  Its purpose is to return the least-valued item from the value list (N1, N2, N3, and so on).
ROUND( ) Syntax :  ROUND(X) ROUND(X,D) Use:  This function returns X rounded to the nearest integer. If a second argument, D, is supplied, then the function returns X rounded to D decimal places.
SIN( ) Syntax:  SIN(X) Use :  This function returns the sine of X
SQRT( ) Syntax:   SQRT(X) Use:  This function returns the non-negative square root of X.
TRUNCATE( ) Syntax:   TRUNCATE(X,D) Use:  This function is used to return the value of X truncated to D number of decimal places.
STRING FUNTIONS Syntax:  ASCII(str) Use:  Returns the numeric value of the leftmost character of the string str.
BIN( ) Syntax:  BIN(N) Use:  Returns a string representation of the binary value of N,
BIT LENGTH( ) Syntax:  BIT_LENGTH(str) Use:  Returns the length of the string str in bits.  Example:  SELECT BIT_LENGTH('text'); BIT_LENGTH('text')  32
CHAR( ) Syntax:  CHAR(N,... [USING charset_name]) Use:  CHAR() interprets each argument N as an integer and returns a string consisting  Example:  SELECT CHAR(77,121,83,81,'76'); MySQL
CHAR LENGTH Syntax:   CHAR_LENGTH(str) Use:  Returns the length of the string str, measured in characters. A multi-byte character counts as a single character
CONCAT( ) Syntax:  CONCAT(str1,str2,...) Use:  MySQL CONCAT function is used to concatenate two strings to form a single string.
FIELD( ) Syntax:   FIELD(str,str1,str2,str3,...) Use:  Returns the index (position starting with 1) of str in the str1, str2, str3, ... list. Returns 0 if str is not found.

More Related Content

What's hot (20)

DOC
SQL
Tuhin_Das
 
PDF
Stata Programming Cheat Sheet
Laura Hughes
 
PDF
Stata cheat sheet: data processing
Tim Essam
 
PPT
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
अभिषेक शर्मा
 
PPT
Oracle naveen Sql
naveen
 
PPTX
SQL
Vineeta Garg
 
PDF
Stata cheatsheet transformation
Laura Hughes
 
PDF
iRODS Rule Language Cheat Sheet
Samuel Lampa
 
PDF
Stata cheat sheet: data transformation
Tim Essam
 
PDF
Data transformation-cheatsheet
Dieudonne Nahigombeye
 
PDF
Data import-cheatsheet
Dieudonne Nahigombeye
 
PDF
The Ring programming language version 1.5.2 book - Part 22 of 181
Mahmoud Samir Fayed
 
PPTX
Pemrograman Terstruktur 4
Moch Mifthachul M
 
PPT
Oracle Sql & PLSQL Complete guide
Raviteja Chowdary Adusumalli
 
PPTX
R: Apply Functions
DataminingTools Inc
 
ODP
Prabu's sql quries
Prabu Cse
 
ODP
My sql Syntax
Reka
 
PDF
Stata Cheat Sheets (all)
Laura Hughes
 
PPTX
String function in my sql
knowledgemart
 
Stata Programming Cheat Sheet
Laura Hughes
 
Stata cheat sheet: data processing
Tim Essam
 
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
अभिषेक शर्मा
 
Oracle naveen Sql
naveen
 
Stata cheatsheet transformation
Laura Hughes
 
iRODS Rule Language Cheat Sheet
Samuel Lampa
 
Stata cheat sheet: data transformation
Tim Essam
 
Data transformation-cheatsheet
Dieudonne Nahigombeye
 
Data import-cheatsheet
Dieudonne Nahigombeye
 
The Ring programming language version 1.5.2 book - Part 22 of 181
Mahmoud Samir Fayed
 
Pemrograman Terstruktur 4
Moch Mifthachul M
 
Oracle Sql & PLSQL Complete guide
Raviteja Chowdary Adusumalli
 
R: Apply Functions
DataminingTools Inc
 
Prabu's sql quries
Prabu Cse
 
My sql Syntax
Reka
 
Stata Cheat Sheets (all)
Laura Hughes
 
String function in my sql
knowledgemart
 

Viewers also liked (20)

PPT
Download It
webhostingguy
 
PPT
Mysql Introduction
hemant meena
 
PDF
Introduction to MySQL
Ted Wennmark
 
PPTX
MySQL clients
yoku0825
 
PPT
MySQL lecture
webhostingguy
 
PDF
MySQL Sandbox 3
Giuseppe Maxia
 
ODP
Mysql database
mayank78634
 
PDF
An introduction to MySQL
Creditas
 
PDF
BITS: Introduction to relational databases and MySQL - SQL
BITS
 
PPTX
Mysql an introduction
Mohd yasin Karim
 
PPTX
MySQL Introduction
mysql content
 
PPT
MySQL
Gouthaman V
 
PDF
Introduction to MySQL
Giuseppe Maxia
 
PPS
Introduction to Mysql
Tushar Chauhan
 
PDF
CBSE XII Database Concepts And MySQL Presentation
Guru Ji
 
PDF
Mysql introduction
Prof. Wim Van Criekinge
 
PPT
MySql slides (ppt)
webhostingguy
 
PPT
Php mysql ppt
Karmatechnologies Pvt. Ltd.
 
Download It
webhostingguy
 
Mysql Introduction
hemant meena
 
Introduction to MySQL
Ted Wennmark
 
MySQL clients
yoku0825
 
MySQL lecture
webhostingguy
 
MySQL Sandbox 3
Giuseppe Maxia
 
Mysql database
mayank78634
 
An introduction to MySQL
Creditas
 
BITS: Introduction to relational databases and MySQL - SQL
BITS
 
Mysql an introduction
Mohd yasin Karim
 
MySQL Introduction
mysql content
 
Introduction to MySQL
Giuseppe Maxia
 
Introduction to Mysql
Tushar Chauhan
 
CBSE XII Database Concepts And MySQL Presentation
Guru Ji
 
Mysql introduction
Prof. Wim Van Criekinge
 
MySql slides (ppt)
webhostingguy
 
Ad

Similar to Mysql1 (20)

PPT
Mysql
HAINIRMALRAJ
 
ODP
Mysqlppt
poornima sugumaran
 
ODP
Mysqlppt
poornima sugumaran
 
ODP
Sqlharshal
ashvinkokate
 
PDF
Bt0075 rdbms with mysql 2
Techglyphs
 
PDF
Chapter8 my sql revision tour
KV(AFS) Utarlai, Barmer (Rajasthan)
 
PDF
Dbms
Sachin Yadav
 
PPT
My sql with querys
NIRMAL FELIX
 
PPTX
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
sdnsdf
 
PPT
MySQL Database System Hiep Dinh
webhostingguy
 
PPT
mysqlHiep.ppt
webhostingguy
 
PPT
My sql presentation
Nikhil Jain
 
PPTX
MySQL String Functions.pptx
MayankSharma867296
 
PPT
MYSQL
Ankush Jain
 
PDF
MySQL for beginners
Saeid Zebardast
 
PPTX
Getting Started with MySQL I
Sankhya_Analytics
 
PPT
Mysql Statments
SHC
 
PDF
Mysqlfunctions
N13M
 
DOCX
Mysql Functions with examples CBSE INDIA 11th class NCERT
Harish Gyanani
 
Sqlharshal
ashvinkokate
 
Bt0075 rdbms with mysql 2
Techglyphs
 
Chapter8 my sql revision tour
KV(AFS) Utarlai, Barmer (Rajasthan)
 
My sql with querys
NIRMAL FELIX
 
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
sdnsdf
 
MySQL Database System Hiep Dinh
webhostingguy
 
mysqlHiep.ppt
webhostingguy
 
My sql presentation
Nikhil Jain
 
MySQL String Functions.pptx
MayankSharma867296
 
MySQL for beginners
Saeid Zebardast
 
Getting Started with MySQL I
Sankhya_Analytics
 
Mysql Statments
SHC
 
Mysqlfunctions
N13M
 
Mysql Functions with examples CBSE INDIA 11th class NCERT
Harish Gyanani
 
Ad

Mysql1

  • 1. MYSQL DEFINITION MySQL, pronounced either &quot;My S-Q-L&quot; or &quot;My Sequel,&quot; is an open source relational database management system. It is based on the structure query language (SQL), which is used for adding, removing, and modifying information in the database.
  • 2. BASIC MySQL COMMAND * CREATE TABLE syntax * DROP TABLE syntax * DELETE syntax * SELECT syntax * JOIN syntax * INSERT syntax * REPLACE syntax * UPDATE syntax
  • 3. 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));
  • 4. 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.
  • 5. DELETE Syntax: Delete from <tablename>; Example: Delete from emp1; Explanation: This command is used to delete the rows and column.
  • 6. SELECT Syntax: Select * from <tablename>; Example: Select * from emp1; Explanation: This command is used to describe the structure of the table.
  • 7. 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.
  • 8. 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.
  • 9. 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.
  • 10. One of the more powerful features of MySQL Proxy is the ability to do &quot; Read/Write Splitting &quot;. The basic concept is to have a master database handle transactional queries while slaves handle SELECT queries. Replication is used to synchronize the changes due to transactional queries with the slaves in the cluster.
  • 11. ADVANCED COMMANDS ->LTRIM ->RTRIM ->SIGN ->AS
  • 16. LTRIM The LTRIM function removes any leading (left-hand) spaces in a character string.Only leading spaces are removed—embedded and trailing spaces are left in the string. Eg: LTRIM (' String with spaces ') Returns this string: 'String with spaces '
  • 17. RTRIM The RTRIM function works like LTRIM, but it removes trailing spaces. If we need to remove both leading and trailing spaces, you can nest LTRIM and RTRIM like this: Eg:RTRIM(LTRIM (' String with spaces ')) Returns this string: 'String with spaces'
  • 18. SIGN The SIGN function takes in a numeric expression and returns one of the following values based on the sign of the input number: Return Value Meaning − 1 Input number is negative 0 Input number is zero 1 Input number is positive Null Input number is null
  • 19. 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.
  • 20. ALTERING THE DATABASE STRUCTURE AND ADDING DATA Syntax: ALATER TABLE tablename ADD clm_name type Example: ALTER TABLE cds -> ADD producerID INT(3);
  • 21. 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.
  • 22. 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>
  • 23. TRUNCATE TABLE Syntax: TRUNCATE TABLE <table_name> Example: TRUNCATE TABLE emp1;
  • 24. Functions can return string, integer, or real values and can accept arguments of those same types.
  • 25. We can define simple functions that operate on a single row at a time, or aggregate functions that operate on groups of rows.
  • 26. Information is provided to functions that enables them to check the number, types, and names of the arguments passed to them. FUNCTIONS
  • 27. FUNCTIONS IN MYSQL Aggregate functions
  • 30. AGGREGATE FUNCTIONS Syntax: SELECT COUNT(*) FROM table_name ; Use: Mysql COUNT function is useful in counting the number of records.
  • 31. MAX AND MIN FUNCTIONS Syntax: SELECT MAX(Col_name) FROM table_name; Use: MySQL MAX function is used to find out the record with maximum value among a record se t.
  • 32. MIN( ) Syntax: SELECT MIN(Col_name) FROM table_name; Use: MySQL MIN function is used to find out the record with minimum value among a record set.
  • 33. AVG( ) Syntax: SELECT AVG(Col_name) FROM table_name; Use: MySQL AVG function is used to find out the average of a field in various records.
  • 34. SUM( ) Syntax: SELECT SUM(Col_name) FROM table_name; Use: MySQL SUM function is used to find out the sum of a field in various records.
  • 35. RAND( ) Syntax: SELECT RAND( ); Use: MySQL has a RAND function that can be invoked to produce random numbers between 0 and 1
  • 36. NUMERIC FUNCTIONS Syntax: ABS(X); Use: The ABS() function returns the absolute value of X.
  • 37. BIT_COUNT( ) Syntax: BIT_COUNT(numeric_value) Use: The BIT_COUNT() function returns the number of bits that are active in numeric_value.
  • 38. CEIL( ) / CEILING( ) Syntax : CEIL(X) CEILING(X) Use: These function return the smallest integer value that is not smaller than X.
  • 39. FLOOR( ) Syntax : FLOOR(X) Use: This function returns the largest integer value that is not greater than X.
  • 40. LEAST( ) Syntax: LEAST(N1,N2,N3,N4,......) Use: Its purpose is to return the least-valued item from the value list (N1, N2, N3, and so on).
  • 41. ROUND( ) Syntax : ROUND(X) ROUND(X,D) Use: This function returns X rounded to the nearest integer. If a second argument, D, is supplied, then the function returns X rounded to D decimal places.
  • 42. SIN( ) Syntax: SIN(X) Use : This function returns the sine of X
  • 43. SQRT( ) Syntax: SQRT(X) Use: This function returns the non-negative square root of X.
  • 44. TRUNCATE( ) Syntax: TRUNCATE(X,D) Use: This function is used to return the value of X truncated to D number of decimal places.
  • 45. STRING FUNTIONS Syntax: ASCII(str) Use: Returns the numeric value of the leftmost character of the string str.
  • 46. BIN( ) Syntax: BIN(N) Use: Returns a string representation of the binary value of N,
  • 47. BIT LENGTH( ) Syntax: BIT_LENGTH(str) Use: Returns the length of the string str in bits. Example: SELECT BIT_LENGTH('text'); BIT_LENGTH('text') 32
  • 48. CHAR( ) Syntax: CHAR(N,... [USING charset_name]) Use: CHAR() interprets each argument N as an integer and returns a string consisting Example: SELECT CHAR(77,121,83,81,'76'); MySQL
  • 49. CHAR LENGTH Syntax: CHAR_LENGTH(str) Use: Returns the length of the string str, measured in characters. A multi-byte character counts as a single character
  • 50. CONCAT( ) Syntax: CONCAT(str1,str2,...) Use: MySQL CONCAT function is used to concatenate two strings to form a single string.
  • 51. FIELD( ) Syntax: FIELD(str,str1,str2,str3,...) Use: Returns the index (position starting with 1) of str in the str1, str2, str3, ... list. Returns 0 if str is not found.
  • 52. FIND_IN_SET( ) Syntax: FIND_IN_SET(str,strlist) Use: Returns a value in the range of 1 to N if the string str is in the string list strlist consisting of N substrings.
  • 53. 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.
  • 54. LCASE( ) / LOWER( ) Syntax: LOWER(str) Use: Returns the string str with all characters changed to lowercase according to the current character set mapping.
  • 55. A stored procedure is a procedure (like a subprogram in a regular computing language) that is stored (in the database).
  • 56. MySQL supports &quot;routines&quot; and there are two kinds of routines: stored procedures or functions whose return values we use in other SQL statements.
  • 57. A stored procedure has a name, a parameter list, and an SQL statement, which can contain many more SQL statements. PROCEDURES
  • 58. CREATE PROCEDURE Syntax: The general syntax of Creating a Stored Procedure is : CREATE PROCEDURE proc_name ([proc_parameter[......]]) routine_body *proc_name : procedure name *proc_parameter : [ IN | OUT | INOUT ] param_name type *routine_body : Valid SQL procedure statement *An IN parameter is used to pass the value into a procedure. *An INOUT parameter is initialized by the caller and it can be modified by the procedure.
  • 59. 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
  • 60. 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
  • 61. 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