SlideShare una empresa de Scribd logo
1 de 1
Descargar para leer sin conexión
Mathematical                                                                                                     Control Flow
             ABS                                                                                                   IFNULL
           SIGN                                                                                                    NULLIF
            MOD                                                                                                    IF
          FLOOR
        CEILING                                                                                                    String
         ROUND                                                                                                     ASCII
             DIV                                                                                                   ORD
             EXP    DATA TYPES                                       MYSQL FUNCTIONS IN PHP                        CONV
              LN                                                                                                   BIN,OCT,HEX
LOG,LOG2,LOG10                      String, length 0 - 255           mysql_affected_rows                           CHAR
                    CHAR
            POW                                                                                                    CONCAT
         POWER      VARCHAR         String, length 0 - 255           mysql_close                                   CONCAT_WS
           SQRT     TINYTEXT        String, length 0 - 255           mysql_connect                                 LENGTH
               PI   TEXT            String, length 0 - 65535         mysql_data_seek                               CHAR_LENGTH
             COS                    String, length 0 - 65535         mysql_db_name                                 BIT_LENGTH
                    BLOB
             SIN                                                                                                   LOCATE
             TAN    MEDIUMTEXT      String, length 0 - 16777215      mysql_errno                                   INSTR
           ACOS     MEDIUMBLOB      String, length 0 - 16777215      mysql_error                                   LPAD
            ASIN    LONGTEXT        String, length 0 - 4294967295    mysql_fetch_array                             RPAD
    ATAN, ATAN2                                                      mysql_fetch_assoc                             LEFT
                    LONGBLOB        String, length 0 - 4294967295
             COT                                                                                                   RIGHT
           RAND     * TINYINT       Integer, -128 to 127             mysql_fetch_field                             SUBSTRING
          LEAST     * SMALLINT      Integer, -32768 to 32767         mysql_fetch_lengths                           MID
      GREATEST      * MEDIUMINT Integer, -8388608 to 8388607         mysql_fetch_object                            SUBSTRING_INDEX
       DEGREES                                                       mysql_fetch_row                               LTRIM
                    * INT       Integer, -2147483648 to
       RADIANS                                                                                                     RTRIM
      TRUNCATE                      2147483647                       mysql_field_flags                             TRIM
                    * BIGINT        Int, -9223372036854775808        mysql_field_len                               SOUNDEX
  Date and Time                     to 9223372036854775807           mysql_field_name                              SPACE
     DAYOFWEEK                                                       mysql_field_seek                              REPLACE
                    FLOAT           Decimal (precise to 23 digits)
       WEEKDAY                                                                                                     REPEAT
   DAYOFMONTH       DOUBLE          Decimal (24 to 53 digits)        mysql_field_table                             REVERSE
     DAYOFYEAR      DECIMAL         "DOUBLE" stored as string        mysql_field_type                              INSERT
          MONTH     DATE            YYYY-MM-DD                       mysql_free_result                             ELT
       DAYNAME                                                       mysql_insert_id                               FIELD
                    DATETIME        YYYY-MM-DD HH:MM:SS
    MONTHNAME                                                                                                      LCASE
        QUARTER     TIMESTAMP       YYYYMMDDHHMMSS                   mysql_list_dbs                                UCASE
           WEEK     TIME            HH:MM:SS                         mysql_list_processes                          LOAD_FILE
            YEAR    ENUM            One of preset options            mysql_list_tables                             QUOTE
      YEARWEEK                                                       mysql_num_fields
                    SET             Selection of preset options
           HOUR                                                                                                    Comparison
         MINUTE                                                      mysql_num_rows                                STRCMP
         SECOND     * Note: "UNSIGNED" TINYINT, SMALLINT,            mysql_pconnect
    PERIOD_ADD      MEDIUMINT, INT, BIGINT have the same             mysql_query                                   Cast
    PERIOD_DIFF                                                      mysql_real_escape_string                      CAST
                    range of values but start at 0, e.g. TINYINT
      DATE_ADD                                                                                                     CONVERT
      DATE_SUB      UNSIGNED is between 0 and 255.                   mysql_select_db
       ADDDATE                                                                                                     Other
        SUBDATE                                                                                                    BIT_COUNT
        EXTRACT     SAMPLE SELECT QUERIES                                                                          DATABASE
        TO_DAYS                                                                                                    USER
     FROM_DAYS      SELECT * FROM tablename                                # Returns all columns                   SYSTEM_USER
   DATE_FORMAT      SELECT column FROM tablename                           # Returns specific column               SESSION_USER
   TIME_FORMAT                                                                                                     CURRENT_USER
                    SELECT COUNT(*) FROM tablename                         # Returns number of rows
  CURRENT_DATE                                                                                                     PASSWORD
  CURRENT_TIME      SELECT SUM(column) FROM tablename                      # Returns sum of column                 OLD_PASSWORD
            NOW     SELECT DISTINCT column FROM tablename                  # Returns unique values of column       ENCRYPT
        SYSDATE     SELECT * FROM tablename WHERE condition                # Returns rows that match condition     DECODE
UNIX_TIMESTAMP                                                                                                     MD5
                    SELECT * FROM tablename WHERE BINARY condition         # Condition is case-sensitive
 FROM_UNIXTIME                                                                                                     SHA1
   SEC_TO_TIME      SELECT * FROM table1 INNER JOIN table2 on              # Join two tables, return all columns   AES_ENCRYPT
   TIME_TO_SEC      table1.id = table2.id                                                                          AES_DECRYPT
                    SELECT table1.* FROM table1 INNER JOIN table2 on       # Only return columns from table1       DES_ENCRYPT
        Group                                                                                                      DES_DECRYPT
                    table1.id = table2.id
        COUNT                                                                                                      LAST_INSERT_ID
          AVG       SELECT LAST_INSERT_ID() as new_id                      # Returns ID of last created row        FORMAT
          MIN       SELECT max(column) AS alias                            # Return maxium value in column as      VERSION
          MAX                                                                "alias"                               CONNECTION_ID
          SUM                                                                                                      GET_LOCK
                    SELECT * FROM table ORDER BY column                    # Return all rows ordering by column
 GROUP_CONCAT                                                                                                      RELEASE_LOCK
     VARIANCE       SELECT * FROM table LIMIT 10, 20                       # Return first 20 rows after row 10     IS_FREE_LOCK
          STD                                                                                                      BENCHMARK
       STDDEV                                                                                                      INET_NTOA
       BIT_OR                                   Available free from AddedBytes.com                                 INET_ATON
      BIT_AND                                                                                                      FOUND_ROWS

Más contenido relacionado

Similar a MySQL Cheatsheet

sql functions3 (1).pdf
sql functions3 (1).pdfsql functions3 (1).pdf
sql functions3 (1).pdfUsha570012
 
Webinar slides: Adding Fast Analytics to MySQL Applications with Clickhouse
Webinar slides: Adding Fast Analytics to MySQL Applications with ClickhouseWebinar slides: Adding Fast Analytics to MySQL Applications with Clickhouse
Webinar slides: Adding Fast Analytics to MySQL Applications with ClickhouseAltinity Ltd
 
ProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdf
ProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdfProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdf
ProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdfJesmar Cannao'
 
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...Ontico
 
Window functions for Data Science
Window functions for Data ScienceWindow functions for Data Science
Window functions for Data ScienceMark Tabladillo
 

Similar a MySQL Cheatsheet (7)

sql functions3 (1).pdf
sql functions3 (1).pdfsql functions3 (1).pdf
sql functions3 (1).pdf
 
Webinar slides: Adding Fast Analytics to MySQL Applications with Clickhouse
Webinar slides: Adding Fast Analytics to MySQL Applications with ClickhouseWebinar slides: Adding Fast Analytics to MySQL Applications with Clickhouse
Webinar slides: Adding Fast Analytics to MySQL Applications with Clickhouse
 
ProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdf
ProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdfProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdf
ProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdf
 
MySQL for beginners
MySQL for beginnersMySQL for beginners
MySQL for beginners
 
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
 
Window functions for Data Science
Window functions for Data ScienceWindow functions for Data Science
Window functions for Data Science
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 

Último

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Último (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

MySQL Cheatsheet

  • 1. Mathematical Control Flow ABS IFNULL SIGN NULLIF MOD IF FLOOR CEILING String ROUND ASCII DIV ORD EXP DATA TYPES MYSQL FUNCTIONS IN PHP CONV LN BIN,OCT,HEX LOG,LOG2,LOG10 String, length 0 - 255 mysql_affected_rows CHAR CHAR POW CONCAT POWER VARCHAR String, length 0 - 255 mysql_close CONCAT_WS SQRT TINYTEXT String, length 0 - 255 mysql_connect LENGTH PI TEXT String, length 0 - 65535 mysql_data_seek CHAR_LENGTH COS String, length 0 - 65535 mysql_db_name BIT_LENGTH BLOB SIN LOCATE TAN MEDIUMTEXT String, length 0 - 16777215 mysql_errno INSTR ACOS MEDIUMBLOB String, length 0 - 16777215 mysql_error LPAD ASIN LONGTEXT String, length 0 - 4294967295 mysql_fetch_array RPAD ATAN, ATAN2 mysql_fetch_assoc LEFT LONGBLOB String, length 0 - 4294967295 COT RIGHT RAND * TINYINT Integer, -128 to 127 mysql_fetch_field SUBSTRING LEAST * SMALLINT Integer, -32768 to 32767 mysql_fetch_lengths MID GREATEST * MEDIUMINT Integer, -8388608 to 8388607 mysql_fetch_object SUBSTRING_INDEX DEGREES mysql_fetch_row LTRIM * INT Integer, -2147483648 to RADIANS RTRIM TRUNCATE 2147483647 mysql_field_flags TRIM * BIGINT Int, -9223372036854775808 mysql_field_len SOUNDEX Date and Time to 9223372036854775807 mysql_field_name SPACE DAYOFWEEK mysql_field_seek REPLACE FLOAT Decimal (precise to 23 digits) WEEKDAY REPEAT DAYOFMONTH DOUBLE Decimal (24 to 53 digits) mysql_field_table REVERSE DAYOFYEAR DECIMAL "DOUBLE" stored as string mysql_field_type INSERT MONTH DATE YYYY-MM-DD mysql_free_result ELT DAYNAME mysql_insert_id FIELD DATETIME YYYY-MM-DD HH:MM:SS MONTHNAME LCASE QUARTER TIMESTAMP YYYYMMDDHHMMSS mysql_list_dbs UCASE WEEK TIME HH:MM:SS mysql_list_processes LOAD_FILE YEAR ENUM One of preset options mysql_list_tables QUOTE YEARWEEK mysql_num_fields SET Selection of preset options HOUR Comparison MINUTE mysql_num_rows STRCMP SECOND * Note: "UNSIGNED" TINYINT, SMALLINT, mysql_pconnect PERIOD_ADD MEDIUMINT, INT, BIGINT have the same mysql_query Cast PERIOD_DIFF mysql_real_escape_string CAST range of values but start at 0, e.g. TINYINT DATE_ADD CONVERT DATE_SUB UNSIGNED is between 0 and 255. mysql_select_db ADDDATE Other SUBDATE BIT_COUNT EXTRACT SAMPLE SELECT QUERIES DATABASE TO_DAYS USER FROM_DAYS SELECT * FROM tablename # Returns all columns SYSTEM_USER DATE_FORMAT SELECT column FROM tablename # Returns specific column SESSION_USER TIME_FORMAT CURRENT_USER SELECT COUNT(*) FROM tablename # Returns number of rows CURRENT_DATE PASSWORD CURRENT_TIME SELECT SUM(column) FROM tablename # Returns sum of column OLD_PASSWORD NOW SELECT DISTINCT column FROM tablename # Returns unique values of column ENCRYPT SYSDATE SELECT * FROM tablename WHERE condition # Returns rows that match condition DECODE UNIX_TIMESTAMP MD5 SELECT * FROM tablename WHERE BINARY condition # Condition is case-sensitive FROM_UNIXTIME SHA1 SEC_TO_TIME SELECT * FROM table1 INNER JOIN table2 on # Join two tables, return all columns AES_ENCRYPT TIME_TO_SEC table1.id = table2.id AES_DECRYPT SELECT table1.* FROM table1 INNER JOIN table2 on # Only return columns from table1 DES_ENCRYPT Group DES_DECRYPT table1.id = table2.id COUNT LAST_INSERT_ID AVG SELECT LAST_INSERT_ID() as new_id # Returns ID of last created row FORMAT MIN SELECT max(column) AS alias # Return maxium value in column as VERSION MAX "alias" CONNECTION_ID SUM GET_LOCK SELECT * FROM table ORDER BY column # Return all rows ordering by column GROUP_CONCAT RELEASE_LOCK VARIANCE SELECT * FROM table LIMIT 10, 20 # Return first 20 rows after row 10 IS_FREE_LOCK STD BENCHMARK STDDEV INET_NTOA BIT_OR Available free from AddedBytes.com INET_ATON BIT_AND FOUND_ROWS