View and kill postgresql connections to database

view and kill postgresql connections to database /* view connections */ SELECT * FROM pg_stat_activity; /*-— Kill connections*/ SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE — don’t kill my own connection! pid != pg_backend_pid() — don’t kill the connections to other databases AND datname = ‘clinical_data’; /* kill a specific connection */ select pg_terminate_backend(13337)

View and kill postgresql connections to database Read More

Utf8_unicode_ci

UTF8_UNICODE_CI CREATE PROCEDURE randomizer() BEGIN DECLARE i INT DEFAULT 0; DECLARE random CHAR(20) ; theloop: loop SET random = CONV(FLOOR(RAND() * 99999999999999), 20, 36); INSERT INTO test VALUES (i+1, random); SET i=i+1; IF i = 500000 THEN LEAVE theloop; END IF; END LOOP theloop; END

Utf8_unicode_ci Read More

Using sum function in mysql for two diffrenet conditions

sum mysql column SELECT sum( mark ) FROM `student` using sum function in mysql for two diffrenet conditions SELECT SUM(CASE WHEN status = ‘Shipped’ THEN quantityOrdered END) qty_shipped, SUM(CASE WHEN status = ‘Resolved’ THEN quantityOrdered END) qty_resolved, SUM(CASE WHEN status = ‘Cancelled’ THEN quantityOrdered END) qty_cancelled, SUM(CASE WHEN status = ‘On Hold’ THEN quantityOrdered END) […]

Using sum function in mysql for two diffrenet conditions Read More

Using mysql database with php

using mysql database with php <?php $servername = “localhost”; $username = “yourusername”; // For MYSQL the predifined username is root $password = “yourpassword”; // For MYSQL the predifined password is ” “(blank) // Create connection $conn = new mysqli($servername, $username, $password); // Check connection if ($conn->connect_error) { die(“Connection failed: ” . $conn->connect_error); } echo “Connected […]

Using mysql database with php Read More