PROGRAMMING
Databases
| Date Published: | |
| Last Modified: |
MariaDB
To change the position of a column:
ALTER TABLE tbl_name MODIFY COLUMN col_name column_definition AFTER col_name;
More info at https://mariadb.com/kb/en/alter-table/.
PostgreSQL
PostgreSQL is a object-orientated database. The main feature of a object-orientated database is that tables can inherit from other tables, which means they automatically get all the data columns of the table they inherit from (similar to object inheritance in object-orientated programming languages).
Inheritance is defined when creating tables with the INHERITS clause with the CREATE TABLE statement:
CREATE TABLE people (
name text,
age int
);
CREATE TABLE student (
student_id text,
) INHERITS (people);
If a table already exists, you can inheritance via the INHERIT variant of the ALTER TABLE statement.
Working With PostgreSQL In Python
One of the most popular PostgreSQL libraries for Python is psycopg2. To install it on Ubuntu you will also need the libpg-dev package on your system:
sudo apt install libpq-dev
pip install psycopg2
Related Content:
- ReStructuredText
- Passing A C++ Member Function To A C Callback
- Consistent Overhead Byte Stuffing (COBS)
- How To Change The IO Scheduling Class And Priority In Linux
- Mbed Studio
