I have a table that has (among other things) a “serial number” (VARCHAR(50)) column and an “active” (BOOLEAN) column… so a sample of data might look like this: Now, from an outside source, I am given a list of serial numbers, like so: Is there a single (ideally) query or series of queries I can run to get the following
Tag: select
avg value from a sql table
I have a MySQL table called track_e_exercises where is stored attempts in a test, every row is a new attempt. I want to know how to obtain the avg attempts in the course per person. How can I make that? c_id is the course id column and exe_user_id is the user id column. expected result for c_id=7 => (# of
How use data in table as entity for key value in SQL?
I have a table as following: Is there any SELECT query to show table in following form? Thanks a lot. Answer You can try following code : UPDATE Since the table is containing more post_id’s, please check the following update.
How to access a table with username with special characters in Oracle sql Developer
I have the following usernames/schema: shopping shops[shopping] In both users I created a table named “SHOP_TAKE_CART”, I use shopping for testing purposes and shops[shopping] to publish …
MYSQL in AWS Athena
Using AWS Athena (so querying with MySql) I’m trying to retrieve information how many times the same IP has been logged. I have columns: timestamp, IP, country. I would like to count unique occurrences of each IP. I’m trying with this query but results are wrong: Thank you for helping achieving me this counter query. EDIT: Sample data: Answer If
a query that sum the count of a row from multiple columns in SQL
I have to write a query that sum the count of a row from multiple columns My code is like this, but total doesn’t work: input: output: Answer Use coalesce as follows:
How do I use OR in mySQL on a Select statement with a greater-than condition?
So I am basically building this mySQL sports database and have a table in which there is a ‘Home_Team’ and ‘Away_Team’, as well as ‘Home_Score’ and ‘Away_Score’. What I need is a query which displays the winning team and score. So it has to select one team if the score is greater than the other team’s; and vice-versa. I have
MYSQL select name from id [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I need to get the name from the author id in table post. I have these 2 tables: post: id
MySQL – select distinct value from two column
I have a table with the following structure: How could I make a select statement on this table, which will return some rows of this table, where in each row, a specific id appears only one, indifferent on which column it is specified? For the above result set, I would like a query that would return: To give another example,
Postres SQL select with GROUP BY and COUNT
i have this SQL select SELECT t.debtor_account, COUNT(t.debtor_account) FROM transaction t GROUP BY t.debtor_account HAVING COUNT(t.debtor_account) > 2; which work, but i need select all from …