对象已移动

可在此处找到该文档 Cheat Sheet of Common MySQL Queries – New Self New Life
New Self New Life
No Result
View All Result
  • Home
  • Entertainment
  • Celebrity
  • Cinema
  • Music
  • Digital Lifestyle
  • Social Media
  • Softwares
  • Devices
  • Home
  • Entertainment
  • Celebrity
  • Cinema
  • Music
  • Digital Lifestyle
  • Social Media
  • Softwares
  • Devices
New Self New Life
No Result
View All Result
Home Softwares

Cheat Sheet of Common MySQL Queries

by admin
3 years ago
in Softwares
Cheat Sheet of Common MySQL Queries
Share on FacebookShare on Twitter


MySQL Database Tutorials

MySQL is a typical and widely-chosen open-source relational database administration system (RDBMS). On this article, we talk about MySQL instructions and supply a cheat sheet of widespread MySQL queries to assist customers work with MySQL extra effectively and successfully.

What’s MySQL Database?

MySQL is an open-source RDBMS developed by Oracle Company. It was initially developed and launched by Swedish firm MySQL AB on Could 23, 1995.

MySQL performs nicely and is dependable with enterprise intelligence (BI) purposes, particularly read-heavy BI purposes. MySQL and InnoDB collectively present nice learn/write speeds for OLTP eventualities and work nicely with excessive concurrency eventualities. Furthermore, MySQL affords two totally different editions, open-source MySQL Neighborhood Server and Proprietary Enterprise Server.

MySQL works on many system platforms, together with Linux, Home windows, macOS, and so forth. Additionally it is one of the steady database administration programs, and a few cloud platforms supply it “as a service.” Cloud-based MySQL companies embrace Oracle MySQL Cloud Service, Amazon Relational Database Service, and Azure Database for MySQL.

Learn: Relational Database Administration Programs (RDBMS): MSSQL vs MySQL

MySQL Instructions

MySQL makes use of instructions to speak with the MySQL database by creating queries with information and performing particular duties and capabilities. The instructions are directions coded into SQL (structured question language) statements. To jot down a question requires a set of predefined code that’s comprehensible to the database.

MySQL helps all SQL-standard varieties of information in a number of classes together with Numeric, Date and Time, String, and Spatial information varieties. The string information varieties embrace Character string and Byte string. MySQL additionally implements spatial extensions as a subset of SQL with Geometry Sorts atmosphere following the Open Geospatial Consortium (OGC) specification.

MySQL Cheat Sheet

Under are a few of the mostly used MySQL instructions and statements that assist customers work with MySQL extra simply and successfully. On this article, we current briefly probably the most generally used instructions – together with MySQL command-line shopper instructions – and the instructions for working with databases, tables, indexes, views, triggers, procedures, and capabilities.

Learn: Finest Database Software program for Builders

MySQL command-line shopper Instructions

Under is a listing of MySQL command-line shopper instructions:

mysql -u [username] -p;      # Connect with MySQL server
mysql -u [username] -p [database];   # Connect with MySQL Server
exit;                                # Exit mysql command-line shopper
mysqldump -u [username] -p [database] > data_backup.sql; # Export information utilizing mysqldump software
mysql> system clear;  # Clear MySQL display console for Linux

The MySQL command-line shopper instructions can be found on Linux for clearing the MySQL display console window, and there’s no shopper command accessible on Home windows OS.

MySQL Instructions for Working with Databases

Under are MySQL instructions used for working with databases:

CREATE DATABASE [IF NOT EXISTS] database_name; # Create a database within the server
SHOW DATABASE; # Present all accessible databases
USE database_name; # Use a database with a specified identify
DROP DATABASE [IF EXISTS] database_name; # Drop a database with a specified identify

MySQL Instructions for Working with Tables

Listed below are MySQL instructions for working with tables in a database:

CREATE TABLE [IF NOT EXISTS] table_name(column_list,...); # Create a brand new desk
SHOW TABLES; # Present all tables within the database
DROP TABLE [IF EXISTS] table_name; # Drop a desk from the database

Generally Used MySQL Instructions

Under is a listing of probably the most generally used MySQL instructions for database builders and database directors utilizing MySQL databases:

ALTER

ALTER TABLE table_name ADD [COLUMN] column_name;
ALTER TABLE table_name DROP [COLUMN] column_name;
ALTER TABLE table_name MODIFY column_name kind;
ALTER TABLE table_name MODIFY column_name kind NOT NULL ...;
ALTER TABLE table_name CHANGE old_column_name new_column_name kind;
ALTER TABLE table_name CHANGE old_column_name new_column_name kind NOT NULL ...;
ALTER TABLE table_name MODIFY column_name kind FIRST;
ALTER TABLE table_name MODIFY column_name kind AFTER another_column;
ALTER TABLE table_name CHANGE old_column_name new_column_name kind FIRST;
ALTER TABLE table_name CHANGE old_column_name new_column_name kind AFTER another_column;
ALTER TABLE table_name ALTER column_name SET DEFAULT ...;
ALTER TABLE table_name ALTER column_name DROP DEFAULT;
ALTER TABLE table_name ADD new_column_name kind;
ALTER TABLE table_name ADD new_column_name kind FIRST;
ALTER TABLE table_name ADD new_column_name kind AFTER another_column;
ALTER TABLE table_name ADD INDEX [name](column, ...);
ALTER TABLE table_name ADD PRIMARY KEY (column_name,...);
ALTER TABLE table_name DROP PRIMARY KEY;

SELECT

SELECT * FROM table_name;
SELECT * FROM table1, table2, …;
SELECT column_name FROM table_name;
SELECT column1, column2, ... FROM table_name;
SELECT column1, column2, ... FROM table1, table2, …;
SELECT select_list FROM table_name WHERE situation;
SELECT select_list FROM desk GROUP BY column1, column2, ...;
SELECT select_list FROM desk GROUP BY column_name HAVING situation;
SELECT COUNT(*) FROM table_name;
SELECT DISTINCT (column_name) FROM    table_name;
SELECT select_list FROM desk ORDER BY column_name;
SELECT select_list FROM desk ORDER BY column1 ASC [DESC], column2 ASC [DESC];
SELECT column_name AS alias_name, expression AS alias, ... FROM table_name;
SELECT select_list FROM table_name WHERE column LIKE '%sample%';
SELECT select_list FROM table_name WHERE column RLIKE 'regular_expression';

SELECT – JOIN

SELECT select_list FROM table1 INNER JOIN table2 ON situation;
SELECT select_list FROM table1 LEFT JOIN table2 ON situation;
SELECT select_list FROM table1 RIGHT JOIN table2 ON situation;
SELECT select_list FROM table1 CROSS JOIN table2;

DESCRIBE

DESCRIBE table_name;
DESCRIBE table_name column_name;

INSERT INTO

INSERT INTO desk (column_list) VALUES(value_list);
INSERT INTO desk (column_list) VALUES(list1), (list2), ...;

UPDATE

UPDATE table_name SET column1 = value1, ...;
UPDATE table_name SET column_1 = value_1, ... WHERE situation;
UPDATE table1, table2 INNER JOIN table1 ON table1.column1 = table2.column2 SET column1 = value1, WHERE situation;

DELETE

DELETE FROM table_name;
DELETE FROM table_name WHERE situation;
DELETE table1, table2 FROM table1 INNER JOIN table2 ON table1.column1= table2.column2 WHERE situation;

INDEX

CREATE INDEX index_name ON table_name (column,...);
DROP INDEX index_name;
CREATE UNIQUE INDEX index_name ON table_name (column,...);

VIEW

CREATE VIEW [IF NOT EXISTS] view_name AS  select_statement;
CREATE VIEW [IF NOT EXISTS] view_name AS select_statement WITH CHECK OPTION;
CREATE OR REPLACE view_name AS select_statement;
DROP VIEW [IF EXISTS] view_name;
DROP VIEW [IF EXISTS] view1, view2, ...;
RENAME TABLE view_name TO new_view_name;
SHOW FULL TABLES [ IN  database_name] WHERE table_type="VIEW";

TRIGGER

CREATE TRIGGER trigger_name  AFTER  UPDATE ON table_name FOR EACH ROW trigger_body;
SHOW TRIGGERS [ IN database_name] [LIKE 'pattern' | WHERE search_condition];
DROP TRIGGER [IF EXISTS] trigger_name;

PROCEDURE

DELIMITER $$ CREATE PROCEDURE procedure_name (parameter_list) BEGIN physique; END $$ DELIMITER;
DROP PROCEDURE [IF EXISTS] procedure_name;
SHOW PROCEDURE STATUS [LIKE 'pattern' | WHERE search_condition];

FUNCTION

DELIMITER $$ CREATE FUNCTION function_name(parameter_list) RETURNS datatype [NOT] DETERMINISTIC BEGIN -- statements END $$ DELIMITER;
DROP FUNCTION [IF EXISTS] function_name;
SHOW FUNCTION STATUS [LIKE 'pattern' | WHERE search_condition];

Customers and Privileges

CREATE USER 'person'@'localhost';
GRANT ALL PRIVILEGES ON base.* TO 'person'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, DELETE ON base.* TO 'person'@'localhost' IDENTIFIED BY 'password';
REVOKE ALL PRIVILEGES ON base.* FROM 'person'@'host';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'person'@'host'; 
FLUSH PRIVILEGES;
SET PASSWORD = PASSWORD('new_pass');
SET PASSWORD FOR 'person'@'host' = PASSWORD('new_pass');
SET PASSWORD = OLD_PASSWORD('new_pass');
DROP USER 'person'@'host';

Conclusion of MySQL Cheat Sheet

MySQL has a status as a particularly quick database for read-heavy workloads, and it’s nice at read-heavy processes. The MySQL cheat sheet consists of probably the most generally used instructions and statements to assist MySQL database customers handle it extra successfully and simply.

Learn extra database administration and database programming tutorials.



Source link

Tags: CheatCommonMySQLQueriesSheet
Previous Post

Jamie Chung Had The Most Cringeworthy Moment With Bradley Cooper & Renée Zellweger At The Gym!

Next Post

Chris Brown accused of rape in $20 million lawsuit

Related Posts

Meta and UK Government launch ‘Open Source AI Fellowship’
Softwares

Meta and UK Government launch ‘Open Source AI Fellowship’

by admin
July 12, 2025
Supervised vs Unsupervised Learning: Machine Learning Overview
Softwares

Supervised vs Unsupervised Learning: Machine Learning Overview

by admin
July 10, 2025
Minor update (2) for Vivaldi Desktop Browser 7.5
Softwares

Minor update (2) for Vivaldi Desktop Browser 7.5

by admin
July 9, 2025
20+ Best Free Food Icon Sets for Designers — Speckyboy
Softwares

20+ Best Free Food Icon Sets for Designers — Speckyboy

by admin
July 8, 2025
Luna v1.0 & FlexQAOA bring constraint-aware quantum optimization to real-world problems
Softwares

Luna v1.0 & FlexQAOA bring constraint-aware quantum optimization to real-world problems

by admin
July 7, 2025
Next Post
Chris Brown accused of rape in $20 million lawsuit

Chris Brown accused of rape in $20 million lawsuit

Andrew Kaczynski welcomes baby after daughter Beans death

Andrew Kaczynski welcomes baby after daughter Beans death

  • Trending
  • Comments
  • Latest
Kanye West entry visa revoked by Australia after ‘Heil Hitler’ song release – National

Kanye West entry visa revoked by Australia after ‘Heil Hitler’ song release – National

July 3, 2025
CBackup Review: Secure and Free Online Cloud Backup Service

CBackup Review: Secure and Free Online Cloud Backup Service

September 18, 2021
Every Van Halen Album, Ranked 

Every Van Halen Album, Ranked 

August 12, 2024
I Tried Calocurb For 90 Days. Here’s My Review.

I Tried Calocurb For 90 Days. Here’s My Review.

January 8, 2025
Bones: All Of Brennan’s Interns, Ranked

Bones: All Of Brennan’s Interns, Ranked

June 15, 2021
Get to Know Ronnie Shacklett – Hollywood Life

Get to Know Ronnie Shacklett – Hollywood Life

December 6, 2023
5 ’90s Alternative Rock Bands That Should’ve Been Bigger

5 ’90s Alternative Rock Bands That Should’ve Been Bigger

April 13, 2025
Clevo CO Review – A Complete Company Details

Clevo CO Review – A Complete Company Details

January 19, 2024
Jeff Lynne Pulls Out of Final ELO Show — See His Statement

Jeff Lynne Pulls Out of Final ELO Show — See His Statement

July 12, 2025
Crypto Billionaire Justin Sun Buys Another $100 Million of Trump’s Memecoin

Crypto Billionaire Justin Sun Buys Another $100 Million of Trump’s Memecoin

July 12, 2025
Paris Haute Couture Week 2025 Best Looks

Paris Haute Couture Week 2025 Best Looks

July 12, 2025
It’s the last day to get up to 50 percent off air fryers, Instant Pots, blenders and more

It’s the last day to get up to 50 percent off air fryers, Instant Pots, blenders and more

July 11, 2025
Hey r/movies! We’re Courtney Stephens and Callie Hernandez, the filmmakers of the recent meta-fictional, experimental feature film INVENTION, that’s now streaming on Mubi. You might also know Callie from La La Land, Alien: Covenant, Blair Witch, Under the Silver Lake, The Endless. Ask us anything!

Hey r/movies! We’re Courtney Stephens and Callie Hernandez, the filmmakers of the recent meta-fictional, experimental feature film INVENTION, that’s now streaming on Mubi. You might also know Callie from La La Land, Alien: Covenant, Blair Witch, Under the Silver Lake, The Endless. Ask us anything!

July 12, 2025
Meta and UK Government launch ‘Open Source AI Fellowship’

Meta and UK Government launch ‘Open Source AI Fellowship’

July 12, 2025
Best Amazon Prime Day 2025 Alternative Sales: Walmart, Target & More

Best Amazon Prime Day 2025 Alternative Sales: Walmart, Target & More

July 11, 2025
Michael Strahan’s extended silence raises questions during GMA absence

Michael Strahan’s extended silence raises questions during GMA absence

July 11, 2025
New Self New Life

Your source for entertainment news, celebrities, celebrity news, and Music, Cinema, Digital Lifestyle and Social Media and More !

Categories

  • Celebrity
  • Cinema
  • Devices
  • Digital Lifestyle
  • Entertainment
  • Music
  • Social Media
  • Softwares
  • Uncategorized

Recent Posts

  • Jeff Lynne Pulls Out of Final ELO Show — See His Statement
  • Crypto Billionaire Justin Sun Buys Another $100 Million of Trump’s Memecoin
  • Paris Haute Couture Week 2025 Best Looks
  • Home
  • Disclaimer
  • DMCA
  • Privacy Policy
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2021 New Self New Life.
New Self New Life is not responsible for the content of external sites. slotsfree  creator solana token

No Result
View All Result
  • Home
  • Entertainment
  • Celebrity
  • Cinema
  • Music
  • Digital Lifestyle
  • Social Media
  • Softwares
  • Devices

Copyright © 2021 New Self New Life.
New Self New Life is not responsible for the content of external sites.

New Self New Life