Heisenberg - Digital Alchemist, Software Architect, Automation Specialist and Mechanical Engineer.
Labels
Android
(1)
Apache
(1)
bash
(2)
boost
(2)
C
(37)
C++
(5)
cheatsheet
(2)
CLion
(6)
css
(3)
Debian
(34)
DL
(17)
dns
(1)
Docker
(3)
Dreamweaver
(2)
Eclipse
(3)
fail2ban
(5)
git
(6)
GitHub
(5)
Hacking
(4)
html
(8)
http
(1)
iOS
(1)
iPad
(1)
IRC
(1)
Java
(33)
javascript
(3)
Linux
(182)
Mac
(21)
Machine Learning
(1)
mySQL
(53)
Netbeans
(6)
Networking
(1)
Nexus
(1)
OpenVMS
(6)
Oracle
(4)
Pandas
(3)
php
(17)
Postgresql
(8)
Python
(9)
raid
(1)
RedHat
(15)
Samba
(2)
Slackware
(52)
SQL
(14)
ssh
(1)
svn
(1)
tar
(1)
ThinkPad
(1)
Virtualbox
(4)
Visual Basic
(2)
Visual Studio
(1)
Windows
(7)
wire
(1)
Showing posts with label Postgresql. Show all posts
Showing posts with label Postgresql. Show all posts
Monday, 31 August 2020
Wednesday, 19 August 2020
MySQL and PostgreSQL comments
/* this is a multiple-line comment */
# this is a comment
-- this is a comment
# this is a comment
-- this is a comment
Saturday, 6 June 2020
Stored Procedures in MySQL and PostgrSQL
The following will create a storied procedure called getPercentage() with MySQL
Note: The DELIMITER $$ exists to change the delimiter used, which is normally ;
This means we can have our statement inside and using a ; but will not be seen as the end of the statement.
This can be called by
DELIMITER $$ CREATE PROCEDURE getPercentage() BEGIN SELECT (COUNT(fault_resolved)/ count(id)*100)AS percent FROM log; END$$ DELIMITER ;
Note: The DELIMITER $$ exists to change the delimiter used, which is normally ;
This means we can have our statement inside and using a ; but will not be seen as the end of the statement.
This can be called by
CALL getPercentage();
Sunday, 10 May 2020
Alternative methods of joining results from two tables
If we are wanting to pull information from two different tables that are linked in some way, the conventional way of doing this is as follows:
SELECT table1.item, table2.item
FROM table1 JOIN table2 ON table1.item = table2.item;
However an alternative is to use the following;
SELECT table1.item, table2.item
FROM table1, table2
WHERE table1.item = table2.item;
Saturday, 29 February 2020
Convert PostgreSQL database to MySQL
Monday, 24 February 2020
Connect to Postgres database with php
This extension enables PHP to connect to and use PostgreSQL databases.
This is specifically for Slackware.
1) install php-pgsql
Slackbuild install file ready for 14.2 here
Slack build page here
2) To enable the pgsql extension for php, go to /etc/php.d/pgsql.iniand uncomment the line:
; extension=pgsql.so
This is specifically for Slackware.
1) install php-pgsql
Slackbuild install file ready for 14.2 here
Slack build page here
2) To enable the pgsql extension for php, go to /etc/php.d/pgsql.iniand uncomment the line:
; extension=pgsql.so
Thursday, 9 January 2020
Replacing postgres database
This is applicable to the Peon application, in so far as when the PAF data is updated and a new database is created, normally to a temp test database for testing, afterwhich a renaming or replacing of working database is required.
Thursday, 14 November 2019
Setup Postgres on Slackware
TODO: Add Slackware install
with user postgres run psql
CREATE DATABASE dbname;
GRANT ALL ON DATABASE dbname TO postgres;
Subscribe to:
Posts (Atom)