Category: MariaDB Database

Added: 15th of September 2019

Viewed: 789 times

Perform basic SELECT queries in MariaDB using the Linux Terminal


This is a four part series of tutorials.


In the last tutorial we created a new database in MariaDB, we also created a new table with some fields and inserted some data.
The data included information about English football teams, their nicknames, stadium_name and capacity.

In this tutorial we will use basic MySQL queries to output information from the database.

Display all records from the table. Display records by id number, in ascending order

SELECT * FROM teams ORDER BY id ASC;



Display all records from the table. Display records by id number, in descending order
SELECT * FROM teams ORDER BY id DESC;



Display all records from the table. Display records by name
SELECT * FROM teams ORDER BY team;



Display all records but only the team field. Display records by id number, in ascending order
SELECT team FROM teams ORDER BY id ASC;



Display all records but only the team and nickname fields. Display records by id number, in ascending order
SELECT team, nickname FROM teams ORDER BY id ASC ;



Count the total number of records in teams table
SELECT COUNT(id) FROM teams;



Display all records where the field capacity is more than 30000 but less than 35000
SELECT * FROM teams WHERE capacity > 30000 AND capacity < 35000;



Display records from the team field beginning with the letter b
SELECT * FROM teams WHERE teams LIKE 'b%';



Display records from the team field beginning with the b and a
SELECT * FROM teams WHERE team LIKE 'b%' OR team LIKE 'a%';

Other Tips & Tutorials

MariaDB Database

Perform basic SELECT queries in MariaDB using the Linux Terminal

Posted: 15th of September 2019

Views: 789

MariaDB Database

Create a new database, table and insert data, using MariaDB in the Linux Terminal

Posted: 12th of September 2019

Views: 749

MariaDB Database

Create a new user using MariaDB database in the Linux Terminal

Posted: 30th of June 2019

Views: 1097

MariaDB Database

Install MariaDB database in Ubuntu based distributions 2019

Posted: 16th of June 2019

Views: 1143

MariaDB Database

Create a new user in MariaDB and GRANT ALL privileges (Part 2)

Posted: 28th of May 2018

Views: 1182