MySQL Visual Basic tutorial. This is a Visual Basic tutorial for the MySQL database. It covers the basics of MySQL programming with Visual Basic. In this tutorial, we use the Connector/Net driver. This driver is based on the ADO.NET specification. The examples were created and tested on Ubuntu Linux.
MySQL and MariaDB are relational database management systems. These tools can be used on your VPS server to manage the data from many different programs. Both implement forms of the SQL querying language, and either can be used on a cloud server.
This guide will cover how to query information from your databases by specifying different search criteria. This will help you pull needed data in flexible ways from your databases.
For this guide, we will be using MySQL on an Ubuntu 12.04 cloud server, but the steps involved will work on either MySQL or MariaDB on any modern Linux distribution.
We tell the database software to retrieve information from our databases using the following syntax:
We will use the default 'mysql' database to practice forming queries:
View the tables within the 'mysql' database to get an idea of the data sources we can query:
On Ubuntu's default MySQL installation, this command returns 24 results.
Let's choose the 'user' table to query results. To get an idea of which categories we can select from, view the table column headers:
The values in the 'Field' column are column headings for the 'user' table.
Let's select some basic information about our users:
The selection fields we've chosen are three of the columns from the 'user' table. Notice how we've separated the different fields with a comma.
THIS ITEM IS NO LONGER AVAILABLE.DISCONTINUED BY MANUFACTURER.The following links, images and informationremain available for informational purposes only.3-in-1 Smart Alarm uses a single sensor to detect both Carbon Monoxide and Natural Gas. Usi electric micn109 blue light. Microprocessor Intelligence provides superior nuisance alarm resistance, temperature & humidity compensation, self diagnostics and Quick Find® alarm origination features.
Each column that we request is returned, in order, from every record in the table.
The previous example returned a nice set of data. That syntax is useful if you wish to return all data related to specific, known criteria.
The SQL querying language allows for more flexible searches. If we wanted to return everything from the 'user' table, we could use the asterisk (*) wildcard, which matches any value:
The results are a bit unwieldy, so they will not be included here. The command will give you every value in every column for every record (line) in the table.
If we want to only return results that meet a certain criteria, we can filter the results with a 'where' filter.
For instance, if we only want to return table data where the user is 'debian-sys-maint', we can filter the query like this:
In the same way, we can see which users are attached to the 'localhost' host:
If we want to filter by more than one term, we can separate the criteria with 'and'.
In 'where' filters, the percentage sign (%) is used as the 'everything' wildcard instead of an asterisk. It will match zero or more characters.
Using this knowledge, we can make use of the 'like' comparison operator, which is another way to filter with 'where'.
The 'like' operator compares the values of a certain field to an expression on the right side. For instance, to select the lines that have a user that starts with 'd', we can perform the following query:
You can specify 'like' comparisons using 'and' or 'or' just like you can with equality comparisons:
You now should have a basic understanding of how to retrieve data from your databases.
There are many other queries that we have not covered, but the list that we mentioned is a good start on how to perform information retrieval in MySQL and MariaDB.
You can learn about how to create and manage databases in MySQL and MariaDB here and how to create tables in MySQL and MariaDB by clicking this link.