matplotlib mySQL blank plot

MySQL
I made this Python script. The idea is using this Python script so that matplotlib can generate a vertical bar chart for me using data from a MySQL da...
1 year ago

Relation between two tables (MySQL)

MySQL
I have two tables : users that contain the following columns: userID int(11) AUTO_INCREMENT PRIMARY KEY name varchar(50) address varchar(30) phone v...
1 year ago

Convert string with array of json (PHP)

MySQL
I stored array of JSON in mysql as a string [{"id": 1, "mark": 5}, {"id": 2, "mark": 3}, {"id": 3, "mark": 2}] When I try to use it @foreach ($pl...
1 year ago

Sum column values in flipped table with generated column names

MySQL
I have the following MySQL-code: select question, sum(case when value = '1' then 1 else 0 end) '1', sum(case when value = '2' then 1...
1 year ago

MySQL and SQL scripting for dummies

MySQL
I have postponed writing SQL code for university, and now that I want to start learning it, I have no idea how to. In C I'd define headers and begin ...
1 year ago

How come this SQL query works?

MySQL
This is a exercise from wikibooks, #6 The table schema is The question is: For each piece, find the most expensive offering of that piece and i...
1 year ago

Join query is going wrong

MySQL
I have two tables. first is travellers_details and second is user_info. traveller_details table has columns id, travel_mode, dep_from, arr_t...
1 year ago

shorthand PDO query

MySQL
Currently to perform a query with PDO, I use the following lines of code: $sql = "SELECT * FROM myTable WHERE id = :id"; $stmt = $conn->prepare($s...
1 year ago

MySQL - errno 150: "Foreign key constraint is incorrectly formed"

MySQL
I am using MySQL on my practice task in tutorial, yet I have a problem on creating a table with error "incorrect constraint". Please have a look and ...
1 year ago

Select two or multiple tables from different databases

MySQL
how to use two tables in a single query, which are in different databases, means, SELECT table1.id, table1.name, table2.id, table2.telephone FROM tab...
1 year ago

MYSQL inventory slots (add item to next slot free)

MySQL
$slt = mysql_query("select Slot, ItemId, UserId, max(Slot) Slot from useritems group by UserId"); while ($sloot = mysql_fetch_assoc($slt)...
1 year ago

MariaDB sql trigger to update if key exists or insert if doesn't exist?

MySQL
I'm new to SQL, but trying to build a simple trigger that will execute on each insertion. I want it to update some table values if the key already exi...
1 year ago

MySQL - find and fix incorrect characters

MySQL
I have a table in MySQL that contains people's names and now some people are putting in characters with accents. Whatever original character set/colla...
1 year ago

How to Limit selection in checklist created directly from MYSQL database and PHP (*Not by manually making a checklist in HTML*)

MySQL
My code so far outputs data from mysql table on a website as a checklist, but I am having trouble setting a limit to how many options can be checked o...
1 year ago

Complex MySQL statement causing error

MySQL
I am trying to combine two working sql statements into one working sql statement. Here are the two sql statements that each work when done seperatel...
1 year ago

Stuck in creating a Simple procedure in MySQL [IF statement]

MySQL
I want to create a procedure in MySql using IF statement that would let me show the names of all students who's average is above 70 when I give the id...
1 year ago

Replace id foreign key with username in query result

MySQL
I have this query which works: SELECT id, SUM(points) AS points FROM leaderboard WHERE roundtime BETWEEN LOCALTIMESTAMP - INTERVAL '24 hours' AND LO...
1 year ago

Mysql count per distinct user with a join

MySQL
currently i have two tables with some data. the first table has the following: +----------------+-----------+ | name | member_id | +-------...
1 year ago

Ranking tied results in MYSQL

MySQL
I have a MYSQL table which looks something like this: ID | NAME CODE | SCORE 1: A01: 1 2: A01: 4 3: A01: 5 4: A02: 2 5: A02: 3 6: A02: 3 7: A02: 7 ...
1 year ago

Order MySQL result by column value

MySQL
I'm sorry if this is bad being my 2nd post today, but I need a little help one more time. I have table in mysql DB which holds some products( id, name...
1 year ago