Create Table
Сообщение 2022-11-09 05:52:29
0
242
To create a MySQL table in Python, use the "CREATE TABLE" statement.
Make sure you define the name of the database when you create the connection.
import mysql.connector mydb = mysql.connector.connect( host="localhost", user="yourusername", password="yourpassword", database="mydatabase" ) mycursor = mydb.cursor() mycursor.execute("CREATE TABLE customers (name VARCHAR(255), address VARCHAR(255))")
Check if Table Exists
You can check if a table exist by listing all tables in your database with the "SHOW TABLES" statement:
import mysql.connector mydb = mysql.connector.connect( host="localhost", user="yourusername", password="yourpassword", database="mydatabase" ) mycursor = mydb.cursor() mycursor.execute("SHOW TABLES") for x in mycursor: print(x)
Поиск
Категории
- Information Technology
- Office Equipment and Supplies
- Cars and Trucks
- Persons
- Books and Authors
- Tutorials
- Art
- Causes
- Crafts
- Dance
- Drinks
- Film
- Fitness
- Food
- Игры
- Gardening
- Health
- Главная
- Literature
- Music
- Networking
- Другое
- Party
- Religion
- Shopping
- Sports
- Theater
- Wellness
Больше
Food Traceability Market Demand: Growth, Share, Value, Size, and Insights
"Executive Summary Food Traceability Market :
CAGR Value
The global food traceability...
カーボンセラミックブレーキパッド日本市場分析レポート:市場規模、成長率、主要企業の動向2025-2031
QYResearch株式会社(所在地:東京都中央区)は、最新の調査資料「カーボンセラミックブレーキパッド―グローバル市場シェアとランキング、全体の売上と需要予測、2025~2031」を2025年...
Disposable Incontinence Products Market Snapshot: Key Metrics, Disruptive Forces & Regional Insights
Executive Summary Disposable Incontinence Products Market :
Data Bridge Market Research...
中圧液封コンプレッサーの世界市場調査レポート:規模、現状、予測2025-2031
2025年6月20日に、QYResearch株式会社(所在地:東京都中央区)は、「中圧液封コンプレッサー―グローバル市場シェアとランキング、全体の売上と需要予測、2025~2031」の調査資料を...
フラックス洗浄機日本市場分析レポート:市場規模、成長率、主要企業の動向2025-2031
2025年7月18日に、QYResearch株式会社(所在地:東京都中央区)は、「フラックス洗浄機―グローバル市場シェアとランキング、全体の売上と需要予測、2025~2031」の調査資料を発行し...
© 2025 Omaada - A global social and professionals networking platform
Russian
