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. Standard SQL commands, such as ADD, DROP, INSERT, and UPDATE can be used with MySQL.
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;
FUNCTIONS IN MYSQL ,[object Object],[object Object],[object Object]
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( ) Synatx:   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.
GREATEST( ) Syntax:  GREATEST(n1,n2,n3,..........) Use:  The GREATEST() function returns the greatest value in the set of input parameters (n1, n2, n3, a nd so on).
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).
PI( ) Syntax:  PI() Use:  This function simply returns the value of pi. MySQL internally stores the full double-precision value of pi.
POW( ) / POWER( ) Syntax:  POW(X,Y) POWER(X,Y) Use:  These two functions return the value of X raised to the power of Y.
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.
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.
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.
LCASE( ) / LOWER( ) Syntax:  LOWER(str) Use:  Returns the string str with all characters changed to lowercase according to the current character set mapping.
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

intro unix/linux 10
intro unix/linux 10intro unix/linux 10
intro unix/linux 10
duquoi
 
Using Unix
Using UnixUsing Unix
Using UnixDr.Ravi
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell ScriptingRaghu nath
 
Learning sed and awk
Learning sed and awkLearning sed and awk
Learning sed and awk
Yogesh Sawant
 
intro unix/linux 08
intro unix/linux 08intro unix/linux 08
intro unix/linux 08
duquoi
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
sudhir singh yadav
 
system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikarsystem management -shell programming by gaurav raikar
system management -shell programming by gaurav raikar
GauravRaikar3
 
Linux intro 3 grep + Unix piping
Linux intro 3 grep + Unix pipingLinux intro 3 grep + Unix piping
Linux intro 3 grep + Unix piping
Giovanni Marco Dall'Olio
 
Shellscripting
ShellscriptingShellscripting
Shellscripting
Narendra Sisodiya
 
Unix Basics
Unix BasicsUnix Basics
Unix BasicsDr.Ravi
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
Chandan Kumar Rana
 
Linux shell env
Linux shell envLinux shell env
Linux shell envRahul Pola
 
58518522 study-aix
58518522 study-aix58518522 study-aix
58518522 study-aix
homeworkping3
 
Easiest way to start with Shell scripting
Easiest way to start with Shell scriptingEasiest way to start with Shell scripting
Easiest way to start with Shell scripting
Akshay Siwal
 
Unix shell scripts
Unix shell scriptsUnix shell scripts
Unix shell scripts
Prakash Lambha
 
Talk Unix Shell Script 1
Talk Unix Shell Script 1Talk Unix Shell Script 1
Talk Unix Shell Script 1Dr.Ravi
 
Bash shell
Bash shellBash shell
Bash shellxylas121
 
Perl Programming - 01 Basic Perl
Perl Programming - 01 Basic PerlPerl Programming - 01 Basic Perl
Perl Programming - 01 Basic Perl
Danairat Thanabodithammachari
 
intro unix/linux 06
intro unix/linux 06intro unix/linux 06
intro unix/linux 06
duquoi
 

What's hot (20)

intro unix/linux 10
intro unix/linux 10intro unix/linux 10
intro unix/linux 10
 
Using Unix
Using UnixUsing Unix
Using Unix
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Learning sed and awk
Learning sed and awkLearning sed and awk
Learning sed and awk
 
intro unix/linux 08
intro unix/linux 08intro unix/linux 08
intro unix/linux 08
 
Unix practical file
Unix practical fileUnix practical file
Unix practical file
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikarsystem management -shell programming by gaurav raikar
system management -shell programming by gaurav raikar
 
Linux intro 3 grep + Unix piping
Linux intro 3 grep + Unix pipingLinux intro 3 grep + Unix piping
Linux intro 3 grep + Unix piping
 
Shellscripting
ShellscriptingShellscripting
Shellscripting
 
Unix Basics
Unix BasicsUnix Basics
Unix Basics
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
 
Linux shell env
Linux shell envLinux shell env
Linux shell env
 
58518522 study-aix
58518522 study-aix58518522 study-aix
58518522 study-aix
 
Easiest way to start with Shell scripting
Easiest way to start with Shell scriptingEasiest way to start with Shell scripting
Easiest way to start with Shell scripting
 
Unix shell scripts
Unix shell scriptsUnix shell scripts
Unix shell scripts
 
Talk Unix Shell Script 1
Talk Unix Shell Script 1Talk Unix Shell Script 1
Talk Unix Shell Script 1
 
Bash shell
Bash shellBash shell
Bash shell
 
Perl Programming - 01 Basic Perl
Perl Programming - 01 Basic PerlPerl Programming - 01 Basic Perl
Perl Programming - 01 Basic Perl
 
intro unix/linux 06
intro unix/linux 06intro unix/linux 06
intro unix/linux 06
 

Similar to Mysql

Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql newSANTOSH RATH
 
Mysqlppt
MysqlpptMysqlppt
MysqlpptReka
 
MySQL-commands.pdf
MySQL-commands.pdfMySQL-commands.pdf
MySQL-commands.pdf
ssuserc5aa74
 
dbms lab manual
dbms lab manualdbms lab manual
dbms lab manual
stalinjothi
 
Cheat Sheet for Stata v15.00 PDF Complete
Cheat Sheet for Stata v15.00 PDF CompleteCheat Sheet for Stata v15.00 PDF Complete
Cheat Sheet for Stata v15.00 PDF Complete
TsamaraLuthfia1
 
SQL
SQLSQL
Structured query language(sql)
Structured query language(sql)Structured query language(sql)
Structured query language(sql)
Huda Alameen
 
Stata Cheat Sheets (all)
Stata Cheat Sheets (all)Stata Cheat Sheets (all)
Stata Cheat Sheets (all)
Laura Hughes
 
DBMS.pdf
DBMS.pdfDBMS.pdf
DBMS.pdf
Rishab Saini
 
The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181
Mahmoud Samir Fayed
 
Pemrograman Terstruktur 4
Pemrograman Terstruktur 4Pemrograman Terstruktur 4
Pemrograman Terstruktur 4
Moch Mifthachul M
 
My sql with querys
My sql with querysMy sql with querys
My sql with querysNIRMAL FELIX
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
Eddyzulham Mahluzydde
 

Similar to Mysql (20)

Mysql1
Mysql1Mysql1
Mysql1
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
Sql
SqlSql
Sql
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
MySQL-commands.pdf
MySQL-commands.pdfMySQL-commands.pdf
MySQL-commands.pdf
 
dbms lab manual
dbms lab manualdbms lab manual
dbms lab manual
 
Cheat Sheet for Stata v15.00 PDF Complete
Cheat Sheet for Stata v15.00 PDF CompleteCheat Sheet for Stata v15.00 PDF Complete
Cheat Sheet for Stata v15.00 PDF Complete
 
Les10 Creating And Managing Tables
Les10 Creating And Managing TablesLes10 Creating And Managing Tables
Les10 Creating And Managing Tables
 
SQL
SQLSQL
SQL
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
Structured query language(sql)
Structured query language(sql)Structured query language(sql)
Structured query language(sql)
 
Stata Cheat Sheets (all)
Stata Cheat Sheets (all)Stata Cheat Sheets (all)
Stata Cheat Sheets (all)
 
DBMS.pdf
DBMS.pdfDBMS.pdf
DBMS.pdf
 
The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181
 
Pemrograman Terstruktur 4
Pemrograman Terstruktur 4Pemrograman Terstruktur 4
Pemrograman Terstruktur 4
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Db1 lecture4
Db1 lecture4Db1 lecture4
Db1 lecture4
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 

Recently uploaded

Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
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
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
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
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 

Recently uploaded (20)

Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
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
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
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
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 

Mysql

  • 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. Standard SQL commands, such as ADD, DROP, INSERT, and UPDATE can be used with MySQL.
  • 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.
  • 11. 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.
  • 12. ALTERING THE DATABASE STRUCTURE AND ADDING DATA Syntax: ALATER TABLE tablename ADD clm_name type Example: ALTER TABLE cds -> ADD producerID INT(3);
  • 13. 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.
  • 14. 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>
  • 15. TRUNCATE TABLE Syntax: TRUNCATE TABLE <table_name> Example: TRUNCATE TABLE emp1;
  • 16.
  • 17. AGGREGATE FUNCTIONS Syntax: SELECT COUNT(*) FROM table_name ; Use: Mysql COUNT function is useful in counting the number of records.
  • 18. 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.
  • 19. 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.
  • 20. 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.
  • 21. 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.
  • 22. RAND( ) Syntax: SELECT RAND( ); Use: MySQL has a RAND function that can be invoked to produce random numbers between 0 and 1
  • 23. NUMERIC FUNCTIONS Syntax: ABS(X); Use: The ABS() function returns the absolute value of X.
  • 24. BIT_COUNT( ) Synatx: BIT_COUNT(numeric_value) Use: The BIT_COUNT() function returns the number of bits that are active in numeric_value.
  • 25. CEIL( ) / CEILING( ) Syntax: CEIL(X) CEILING(X) Use: These function return the smallest integer value that is not smaller than X.
  • 26. FLOOR( ) Syntax: FLOOR(X) Use: This function returns the largest integer value that is not greater than X.
  • 27. GREATEST( ) Syntax: GREATEST(n1,n2,n3,..........) Use: The GREATEST() function returns the greatest value in the set of input parameters (n1, n2, n3, a nd so on).
  • 28. 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).
  • 29. PI( ) Syntax: PI() Use: This function simply returns the value of pi. MySQL internally stores the full double-precision value of pi.
  • 30. POW( ) / POWER( ) Syntax: POW(X,Y) POWER(X,Y) Use: These two functions return the value of X raised to the power of Y.
  • 31. 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.
  • 32. SIN( ) Syntax: SIN(X) Use: This function returns the sine of X
  • 33. SQRT( ) Syntax: SQRT(X) Use: This function returns the non-negative square root of X.
  • 34. TRUNCATE( ) Syntax: TRUNCATE(X,D) Use: This function is used to return the value of X truncated to D number of decimal places.
  • 35. STRING FUNTIONS Syntax: ASCII(str) Use: Returns the numeric value of the leftmost character of the string str.
  • 36. BIN( ) Syntax: BIN(N) Use: Returns a string representation of the binary value of N,
  • 37. 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
  • 38. 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
  • 39. 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
  • 40. CONCAT( ) Syntax: CONCAT(str1,str2,...) Use: MySQL CONCAT function is used to concatenate two strings to form a single string.
  • 41. 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.
  • 42. 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.
  • 43. 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.
  • 44. LCASE( ) / LOWER( ) Syntax: LOWER(str) Use: Returns the string str with all characters changed to lowercase according to the current character set mapping.
  • 45. 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
  • 46. 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
  • 47. 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