I’m practicing for my SQL exam and I can’t figure out the following question: “Of the average amount paid per customer, show the highest amount.” So to retrieve the average amount paid, I would do the following: Then I would like to retrieve the highest average amount out of this list …
Tag: sql
Why does my button not pass the Order ID onto another page?
I have a page called order_page.php and it has a hyperlink that should pass the Order ID of a particular order to another page called edit.php. I looked up some tutorials on youtube but it’s still …
Join the records with sql?
I have a table with those 5 rows. code | type_id | status —–+——–+——– 123 | 123456 | DONE 123 | 456789 | DONE 321 | 654321 | DONE 321 | 897321 | DONE 456 | 999888 | DONE 456 | …
SQL sequent grouped rows
+——+——+——+————+ | id | room | type | created_at | +——+——+——+————+ | 8214*| 83 | msg* | 1571726466 | | 8213 | 83 | msg* | 1571724983 | | 8212 | 83 | ad …
MySQL: Is it possible to set a variable outside of SELECT with SELECT as the only permission?
WHAT I’m on MySQL 5.6 and my account only has permissions for SELECT and USAGE (as found using the SHOW GRANTS command). Presumably because of this using DECLARE before SELECT returns a generic …
Postgres Dump Selected Rows
I have a database that has a central object that most of the data depends on; many reference table, one to many joins and many to many joins. I need to back up all rows based on a property in the central table and be able to restore these rows. For backup purposes. I have added ON DELETE CASCADE to
How to represent X and Y axis data in an SQL table
I have a table of data in excel that looks like this: I need to get this data imported into an SQL table. Eventually I need to be able to query the table by saying something like: Select the value where x-axis equals 762 and y-axis equals 889 – this should return 30.60. What is the best way to represent
The most efficient method of performing a large number of similar SELECT queries on PostgreSQL?
I have a set of large tables with many records each. I’m writing a Python program that SELECTs a large number of records from these tables, based on the value of multiple columns on those records. Essentially, these are going to be lots of queries of the form: Each table has a different set of columns, …
MySQL: Best way finding rows, where associated list match a given list
I built a SQL Statement, explained here: I have a table Account like this: I have a table Customer like this: I have a relation Customer_To_Account like this: I want to find all accounts which are assigned to customers in a given list like (111111, 222222). The returned accounts MUST contain at least one of t…
My SQL Python ProgrammingError: 1064 (42000) [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 2 years ago. Improve this question I am trying to store scraped data with scrapy to a sql database but I…