3.4 creating tables in MYSQL

 

v  Creating Tables: -

Ø For creating tables,

·      Import mysql.connector.

·      Connect to MySQL database using connect( ) method.

·      Create a cursor( ) object then pass SQL command of table as a string to the execute( ) method.

Ø The SQL command to create table in database with python code is:

      Example: -

Output: -


Ø          First open database using “use database_name;” command.

Ø  We can check if the table exists in database system or not, by using “show tables” command.


Ø  To view the structure of table, we use “describe table_name” command.


Popular posts from this blog

operators in c programming

Variables in c

Cloud Storage and Local Storage: Applications in Business