MariaDB list columns of Tables

In mariaDB if we want to see the name and the type of the different columns in a table, we should run: SHOW COLUMNS IN <tableName>; For example to check the columns' names and types of fruit table, we run: MariaDB [food]> SHOW COLUMNS IN fruit; +-------+------+------+-----+---------+-------+ | Field | Type | Null | Key … Continue reading MariaDB list columns of Tables


SQL DELETE command

DELETE command is used to delete row from table. The structure is the following: DELETE FROM <tableName> WHERE <condition>; Warning: if we don't put condition, then it will simply delete all rows in the table. For example, say we have: MariaDB [firstDB]> SELECT * FROM employee; +------------+-----------+-----------------+--------+ | first_name | last_name | employee_number | salary … Continue reading SQL DELETE command

SQL UPDATE command

SQL UPDATE command is used to update existing rows in the database. The command structure is the following: UPDATE <tableName> SET <columnName>=<newValue> WHERE <condition>; If we don't put WHERE condition, then it will update all rows, so we should be very carefully to put the WHERE condition. For example if we have the following table: … Continue reading SQL UPDATE command


JOIN command in SQL allow you to retrieve data from more than one table and mix and match them. The structure  is the following: SELECT <alias1>.<column1>, <alilas2>.<column2> FROM <tableName1> AS <alias1> JOIN <table2> AS <alias2> ON <alias1>.<matchingColumn1> = <alias2>.<matchingColumn2>; After the "ON" we put the matching condition that tell the SQL how to match rows … Continue reading SQL SELECT JOIN

MariaDB (and SQL) select command

select command is a SQL standard command, and is used to retrieve information from database tables. If you want to get all rows and columns from specific tables,then it is very simple: SELECT * FROM <tableName>; For example if we want to see all row in the employee table: MariaDB [firstDB]> SELECT * FROM employee; … Continue reading MariaDB (and SQL) select command

MariaDB INSERT command

The  structure  of INSERT command is INSERT INTO <theTableNameToInsert> (<column1>, <column2>) VALUES (<value1ForColumn1>, <value1ForColumn2>), (<value2ForColumn1>, <value2ForColumn2>); Basically we give it the table name, the order of the columns for every row (inside the first parenthesis, and then the values of the rows, every row in its own parenthesis. The number of columns depend in the … Continue reading MariaDB INSERT command

MariaDB creating Tables

First you need to make sure you are using the correct database (if don't know how, it was explained in previous post). So in order to create table we need to use CREATE TABLE command. The simple structure is following: CREATE TABLE <tableName> (<columnName1> <type1>, <columnName2> <type2>,...); The list of data types for MariaDb is … Continue reading MariaDB creating Tables

Working with MariaDB – basic command

So you have installed and logged in into MariaDB. What next? You probably get the following screen: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 47 Server version: 10.0.25-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04 Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. … Continue reading Working with MariaDB – basic command

Installing MariaDB on Ubuntu

Mariadb is an excellent relational database management system that started as a fork  for mySQL. The reason for the fork was concern over the way that Oracle is taking mysql. Installing MariaDBin on Ubuntu 16.04 is very easy. Since it is part of the ubuntu repository, then apt-get install mariadb-server will install mariaDB. bob@vmUbuntu:~$ sudo apt-get install … Continue reading Installing MariaDB on Ubuntu