Compare commits

..

8 Commits

Author SHA1 Message Date
Julien Le Coupanec
38f406dc19 Merge pull request #442 from michaelmjhhhh/michaelmjhhhh-update-mysql-cheatsheet
Add essential sections to MySQL: Alter, Indexes, and Transactions
2026-04-12 19:26:10 +02:00
Julien Le Coupanec
6326628901 Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-12 19:25:52 +02:00
Julien Le Coupanec
a75ee3956e Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-12 19:25:31 +02:00
Julien Le Coupanec
925eff9d91 Merge pull request #443 from Dhagash1206/master
Link fixes in the readme
2026-04-12 19:18:12 +02:00
Julien Le Coupanec
9f52e75aaa Merge branch 'master' into master 2026-04-12 19:17:59 +02:00
Dhagash1206
91bef75a8a Update README index coverage and naming consistency.
Add missing cheat sheet links and standardize JavaScript heading capitalization to improve discoverability.

Made-with: Cursor
2026-03-21 13:43:27 +05:30
Dhagash pandya
aecfaa8f1a Enhance Readme 2026-03-21 13:22:04 +05:30
Ma JingHan
e8730f4987 Add essential sections to MySQL: Alter, Indexes, and Transactions
I have enhanced the MySQL cheat sheet by adding three essential sections that were previously missing:

1. Altering Table Structure: Commands for adding, modifying, renaming, and dropping columns/tables.
2. Indexes (Performance Tuning): Added CREATE INDEX, SHOW INDEX, and the EXPLAIN command for query analysis.
3. Transactions (Data Integrity): Added START TRANSACTION, COMMIT, and ROLLBACK for managing database consistency.
2026-03-21 14:45:28 +08:00
2 changed files with 72 additions and 26 deletions

View File

@@ -1,21 +1,29 @@
<div align="center">
[![AWESOME CHEATSHEETS LOGO](_design/cover_github@2x.png)](https://lecoupa.github.io/awesome-cheatsheets/) [![AWESOME CHEATSHEETS LOGO](_design/cover_github@2x.png)](https://lecoupa.github.io/awesome-cheatsheets/)
<p align=center> <a href="https://trendshift.io/repositories/5584" target="_blank">
<a href="https://trendshift.io/repositories/5584" target="_blank"><img src="https://trendshift.io/api/badge/repositories/5584" alt="LeCoupa%2Fawesome-cheatsheets | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a> <img src="https://trendshift.io/api/badge/repositories/5584" alt="LeCoupa%2Fawesome-cheatsheets | Trendshift" width="250" height="55"/>
</p> </a>
[![Awesome](https://awesome.re/badge.svg)](https://awesome.re) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/LeCoupa/awesome-cheatsheets/blob/master/LICENSE) [![Awesome](https://awesome.re/badge.svg)](https://awesome.re) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/LeCoupa/awesome-cheatsheets/blob/master/LICENSE)
**WEBSITE DIRECTORY**: [Available here](https://lecoupa.github.io/awesome-cheatsheets/). **WEBSITE DIRECTORY**: [Available here](https://lecoupa.github.io/awesome-cheatsheets/)
> 📚 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file. > 📚 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file.
</div>
---
## 🤔 Why Awesome-Cheatsheets? ## 🤔 Why Awesome-Cheatsheets?
I usually make a cheat sheet when I want to improve my skills in a programming language, a framework or a development tool. [I started doing these kinds of things a long time ago on Gist](https://gist.github.com/LeCoupa). To better keep track of the history and to let people contribute, I re-organized all of them into this single repository. Most of the content is coming from official documentation and some books I have read. I usually make a cheat sheet when I want to improve my skills in a programming language, a framework or a development tool. [I started doing these kinds of things a long time ago on Gist](https://gist.github.com/LeCoupa). To better keep track of the history and to let people contribute, I re-organized all of them into this single repository. Most of the content is coming from official documentation and some books I have read.
Feel free to take a look. You might learn new things. They have been designed to provide a quick way to assess your knowledge and to save you time. Feel free to take a look. You might learn new things. They have been designed to provide a quick way to assess your knowledge and to save you time.
---
## 📚 Table of Contents ## 📚 Table of Contents
### 📃 Languages ### 📃 Languages
@@ -24,47 +32,47 @@ Feel free to take a look. You might learn new things. They have been designed to
<summary>View cheatsheets</summary> <summary>View cheatsheets</summary>
#### Command line interface #### Command line interface
- [Bash](languages/bash.sh) - [Bash](languages/bash.sh)
#### Imperative #### Imperative
- [C](languages/C.txt) - [C](languages/C.txt)
- [C#](languages/C%23.txt) - [C#](languages/C%23.txt)
- [Go](languages/golang.md) - [Go](languages/golang.md)
- [Java](languages/java.md) - [Java](languages/java.md)
- [PHP](languages/php.php) - [PHP](languages/php.php)
- [Python](languages/python.md) - [Python](languages/python.md)
- [XML](languages/XML.md)
#### Functional #### Functional
- [JavaScript](languages/javascript.js) - [JavaScript](languages/javascript.js)
- [Typescript](languages/typescript.md) - [Typescript](languages/typescript.md)
</details> </details>
---
### 📦 Backend ### 📦 Backend
<details> <details>
<summary>View cheatsheets</summary> <summary>View cheatsheets</summary>
#### PHP #### PHP
- [Laravel](backend/laravel.php) - [Laravel](backend/laravel.php)
#### Python #### Python
- [Django](backend/django.py) - [Django](backend/django.py)
#### Javascript #### JavaScript
- [Adonis.js](backend/adonis.js) - [Adonis.js](backend/adonis.js)
- [Express.js](backend/express.js) - [Express.js](backend/express.js)
- [Feathers.js](backend/feathers.js) - [Feathers.js](backend/feathers.js)
- [Moleculer](backend/moleculer.js) - [Moleculer](backend/moleculer.js)
- [Node.js](backend/node.js) - [Node.js](backend/node.js)
- [Sails.js](backend/sails.js) - [Sails.js](backend/sails.js)
</details>
</details>
---
### 🌐 Frontend ### 🌐 Frontend
@@ -73,23 +81,20 @@ Feel free to take a look. You might learn new things. They have been designed to
<summary>View cheatsheets</summary> <summary>View cheatsheets</summary>
#### Basics #### Basics
- [HTML5](frontend/html5.html) - [HTML5](frontend/html5.html)
- [CSS3](frontend/css3.css) - [CSS3](frontend/css3.css)
- [Typescript](frontend/typescript.ts)
#### Frameworks #### Frameworks
- [React.js](frontend/react.js) - [React.js](frontend/react.js)
- [Vue.js](frontend/vue.js) - [Vue.js](frontend/vue.js)
- [Tailwind.css](frontend/tailwind.css) - [Tailwind.css](frontend/tailwind.css)
- [Ember.js](frontend/ember.js) - [Ember.js](frontend/ember.js)
- [Angular (2+)](frontend/angular.js) - [Angular (2+)](frontend/angular.js)
- [AngularJS](frontend/angularjs.js) - [AngularJS](frontend/angularjs.js)
</details>
#### Typescript ---
- [Typescript](frontend/typescript.ts)
</details>
### 🗃️ Databases ### 🗃️ Databases
@@ -97,13 +102,15 @@ Feel free to take a look. You might learn new things. They have been designed to
<summary>View cheatsheets</summary> <summary>View cheatsheets</summary>
#### SQL #### SQL
- [MySQL](databases/mysql.sh) - [MySQL](databases/mysql.sh)
#### NoSQL #### NoSQL
- [MongoDB](databases/mongodb.sh)
- [Redis](databases/redis.sh) - [Redis](databases/redis.sh)
</details>
</details>
---
### 🔧 Tools ### 🔧 Tools
@@ -111,7 +118,6 @@ Feel free to take a look. You might learn new things. They have been designed to
<summary>View cheatsheets</summary> <summary>View cheatsheets</summary>
#### Development #### Development
- [cURL](tools/curl.sh) - [cURL](tools/curl.sh)
- [Drush](tools/drush.sh) - [Drush](tools/drush.sh)
- [Elasticsearch](tools/elasticsearch.js) - [Elasticsearch](tools/elasticsearch.js)
@@ -124,25 +130,35 @@ Feel free to take a look. You might learn new things. They have been designed to
- [Xcode](tools/xcode.txt) - [Xcode](tools/xcode.txt)
#### Infrastructure #### Infrastructure
- [AWS CLI](tools/aws.sh) - [AWS CLI](tools/aws.sh)
- [Docker](tools/docker.sh) - [Docker](tools/docker.sh)
- [GCP CLI](tools/gcp.md)
- [Heroku CLI](tools/heroku.sh) - [Heroku CLI](tools/heroku.sh)
- [Kubernetes](tools/kubernetes.md) - [Kubernetes](tools/kubernetes.md)
- [macOS](tools/macos.sh)
- [Nanobox Boxfile](tools/nanobox_boxfile.yml) - [Nanobox Boxfile](tools/nanobox_boxfile.yml)
- [Nanobox CLI](tools/nanobox_cli.sh) - [Nanobox CLI](tools/nanobox_cli.sh)
- [Nginx](tools/nginx.sh) - [Nginx](tools/nginx.sh)
- [PM2](tools/pm2.sh) - [PM2](tools/pm2.sh)
- [Ubuntu](tools/ubuntu.sh) - [Ubuntu](tools/ubuntu.sh)
- [Firebase CLI](tools/firebase_cli.md) - [Firebase CLI](tools/firebase_cli.md)
</details>
</details>
---
## 🙌🏼 How to Contribute? ## 🙌🏼 How to Contribute?
You are more than welcome to contribute and build your own cheat sheet for your favorite programming language, framework or development tool. Just submit changes via pull request and I will review them before merging. You are more than welcome to contribute and build your own cheat sheet for your favorite programming language, framework or development tool. Just submit changes via pull request and I will review them before merging.
---
## 👩‍💻👨‍💻 Our valuable Contributors ## 👩‍💻👨‍💻 Our valuable Contributors
<p align="center"><a href="https://github.com/LeCoupa/awesome-cheatsheets/graphs/contributors"> <div align="center">
<a href="https://github.com/LeCoupa/awesome-cheatsheets/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=LeCoupa/awesome-cheatsheets" /> <img src="https://contributors-img.web.app/image?repo=LeCoupa/awesome-cheatsheets" />
</a></p> </a>
</div>

View File

@@ -82,3 +82,33 @@ SELECT User, Host FROM mysql.user; # List all current MySQL users
SET GLOBAL general_log = 'ON'; # Enable query logging SET GLOBAL general_log = 'ON'; # Enable query logging
SHOW FULL PROCESSLIST; # Show the last queries executed in MySQL SHOW FULL PROCESSLIST; # Show the last queries executed in MySQL
# *****************************************************************************
# Altering Table Structure
# *****************************************************************************
ALTER TABLE table_name ADD COLUMN column_name datatype; # Add a new column to an existing table
ALTER TABLE table_name MODIFY COLUMN column_name datatype; # Change the data type of a column
ALTER TABLE table_name RENAME COLUMN old_name TO new_name; # Rename a column (MySQL 8.0+)
ALTER TABLE table_name DROP COLUMN column_name; # Remove a column from a table
ALTER TABLE old_table_name RENAME TO new_table_name; # Rename an entire table
# *****************************************************************************
# Indexes (Performance Tuning)
# *****************************************************************************
CREATE INDEX idx_name ON table_name (column_name); # Create a standard index to speed up queries
CREATE UNIQUE INDEX idx_name ON table_name (column_name); # Create a unique index (no duplicate values)
SHOW INDEX FROM table_name; # List all indexes on a specific table
DROP INDEX idx_name ON table_name; # Remove an index from a table
EXPLAIN SELECT * FROM table_name WHERE condition; # Analyze how MySQL executes a query (Check index usage)
# *****************************************************************************
# Transactions (Data Integrity)
# *****************************************************************************
START TRANSACTION; # Begin a new transaction
COMMIT; # Save all changes made during the transaction
ROLLBACK; # Undo all changes if an error occurs before commit
SET AUTOCOMMIT = 0; # Disable automatic commits for the current session
SET AUTOCOMMIT = 1; # Re-enable automatic commits after finishing manual transactions