We are going to witness the answer for those questions

MySql Pythonk Tutorial

basic querys in mysql

  1. To create a database:

    • Query:
    • "create database database name"
    • eg:"create database students"
  2. database_creation
  3. to create a table in a database:

    • Query:
    • "create table tablename(column 1,column 2,..)"
    • eg:"create table laptops(id int,name varchar(100),price int)"
    • here int indicates the datatype of the column id and the varchar(strings) indicate the datatype of the column name,that 100 represent the number of characters allowed.
  4. database_creation
  5. To insert the data in the table:

    • Query:
    • "insert into tablename(column1,column2,column3) values(value1 ,value2 ,value3)"
    • "insert into laptops(id,name,price) values(1 ,dell E720 ,75000)"
  6. database_creation
  7. To Select the value fron the table:

    • Query:
    • "select * from tablename "
    • eg:"select * from laptops"
  8. database_creation
  9. To update the data in the database:

    • Query:
    • "update table name set (value and column we wanna change) where condition"
    • eg:"update laptops set name="macbook air" where id =2"
  10. database_updation
  11. To delete the data in the database:

    • Query:
    • "delete from tablename where(condition)"
    • eg:"delete from laptops where (id=1)"
    • the data corresponding to the id=1 where deleted from the table.
  12. database_deletion