Giter VIP home page Giter VIP logo

sqlpython's Introduction

sqlPython

The below commands are used to install mysql-connector-python in command prompt PYTHON SQL CONNECTOR COMMANDS: python -m pip install mysqlclient python -m pip install mysql-connector-python python -m pip install pymysql

The below code is used to check whether mysql.connector module is installed or not....

--> Refer demo_my_sql_test import mysql.connector """If the above code is executed with no errors, then you have "mysql.connector" module insatlled"""

--> Refer demo_mysql_connect.py

After importing the module """we can start creating connection to the database by using user name and password""" """ mydb = mysql.connector.connect( host="localhost", user="your_user_name", password="your_MySQL_Password" )

--> Refer creating_db_by_sqlpy.py Creating a DataBase """we can create database by CREATE DATABASE statement""" """Cusror() function is used Allows Python code to execute PostgreSQL command in a database session. """ """cursor() method: they are bound to the connection for the entire lifetime and all the commands are executed in the context of the database session wrapped by the connection.""" cur = mydb.cursor() cur is the reference.. by using execute() method we can create database

--> Refer returning_db_list.py and db_exist or not.py

*** To check if the database is created or not we use the command "SHOW DATABASES;"

            -->     CREATING A TABLE    <--

--> Refer creating_table.py ""we can create TABLE by CREATE TABLE table_Name statement""" mydb = mysql.connector.connect( host="localhost", user="your_user_name", password="your_MySQL_Password" database="Database name" ) we have to provide database name to store the tables

-- Checking if table is exists or not by using "SHOW TABLES;" statement --> Refer check_if_table_exists.py

        --> Altering the table <--

--> Refer aletering_the_table.py --> Refer multiple_statements_execute.py

sqlpython's People

Contributors

nidimamidi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.