MariaDB is an open source Database Management System and its predecessor to MySQL. The pymysql client can be used to interact with MariaDB similar to that of MySQL using Python.
In this article we will look into the process of querying data from a table of the database using pymysql. To query data use the following syntax:
- In order to select particular attribute columns from a table, we write the attribute names.
SELECT attr1, attr2 FROM table_name
- In order to select all the attribute columns from a table, we use the asterisk ‘*’ symbol.
SELECT * FROM table_name
Example 1 :
The above program illustrates the connection with the MariaDB database ‘GFG‘ in which host-name is localhost, the username is ‘user’ and password is ‘your password’.
Example 2 :
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python MariaDB - Update Query using PyMySQL
- Python MariaDB - Delete Query using PyMySQL
- Create Database in MariaDB using PyMySQL in Python
- Python MariaDB - Drop Table using PyMySQL
- Python MariaDB - Order By Clause using PyMySQL
- Python MariaDB - Limit Clause using PyMySQL
- Python MariaDB - Where Clause using PyMySQL
- Python MariaDB - Insert into Table using PyMySQL
- Connect to MySQL using PyMySQL in Python
- Python MySQL - Select Query
- Char_Length()Function AND ASCII() Function in MariaDB
- Python | Get a set of places according to search query using Google Places API
- Select first or last N rows in a Dataframe using head() and tail() method in Python-Pandas
- How to select a drop-down menu value using Selenium in Python?
- Select Drop-down list using select_by_index() in Selenium - Python
- Selecting with complex criteria using query method in Pandas
- Select any row from a Dataframe using iloc and iat in Pandas
- Select Rows & Columns by Name or Index in Pandas DataFrame using [ ], loc & iloc
- Python | Filtering data with Pandas .query() method
- Python MySQL - Delete Query
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.