Sqlite
Sqlite
● Python Path is an environment variable that tells the operating system where to find
Python executables and libraries.
● To set Python Path:
○ Windows:
1. Right-click on "This PC" > "Properties."
2. Click "Advanced system settings."
3. Go to "Environment Variables."
4. Under "System variables," find "Path" and edit it.
5. Add the path to your Python installation (e.g., C:\Python39).
○ You can add this line to your .bashrc or .zshrc file for permanent changes.
2. What is to use cursor when cursor in with example. we need python explain
● In Python, the cursor is used in databases to interact with data. It allows you to
execute SQL queries and fetch data.
# Connect to a database
conn = sqlite3.connect('example.db')
cursor = conn.cursor()
# Create a table
cursor.execute('''CREATE TABLE students (name TEXT, age INTEGER)''')
# Insert data
cursor.execute("INSERT INTO students VALUES ('John', 21)")
# Fetch data
cursor.execute("SELECT * FROM students")
result = cursor.fetchall()
4. How to set Python Path, explain Concept of and Packages. namespace, scope
plt.bar(categories, values)
plt.xlabel('Categories')
plt.ylabel('Values')
plt.title('Bar Chart Example')
● plt.show()
**7. What is matplotlib.pyplot? What function of pyplot we use for plotting in Data
Visualization?**
**8. Explain Select, Insert, Update, Delete Using with Execute function to interact with
SQLite.**
In **SQLite**, you interact with the database using **cursor.execute()** to run SQL queries.
Here's how to use it for `SELECT`, `INSERT`, `UPDATE`, and `DELETE`:
**1. What is matplotlib? What is the difference between bar, scatter, line, and histogram?**
- **matplotlib** is a comprehensive library used in Python for creating static, animated, and
interactive visualizations. It is widely used for plotting different types of graphs to visualize
data.
- **Line chart**: Used to show trends over time or continuous data. Each point is connected
by a line.
- Example: Tracking the stock price of a company over time.
- Function: `plt.plot()`
- **Histogram**: Displays the distribution of a dataset by grouping data into bins and
showing the frequency of each bin.
- Example: Showing the distribution of exam scores in a class.
- Function: `plt.hist()`
These chart types serve different purposes depending on the type of data and the message
you want to convey.