Q. Create a database TESTDB.


• Create a table EMPLOYEE with Fields FIRST_NAME, LAST_NAME, AGE, SEX and INCOME in TESTDB.


Answer =


import mysql.connector as a
db = a.connect(host="localhost",user="root",password="Path walla ", database = "TESTDB")

cursor = db.cursor() 
cursor.execute("Create table EMPLOYEE ( FIRST_NAME char(50), LAST_NAME char(50), AGE integer, SEX char(1) , INCOME integer )")
db.commit() 
db.close()



Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post