Hello I would like to ask how can I have the total number of patients in certain distinct age groups using queries? Answer In MySQL. In other DBMS similarly, but you must precise what you use.
Tag: mysql
How do I do NOT CONTAINS?
I’m having difficulties with a question on an assignment and writing the correct query. I’ve been at it for days, and it’s due soon. I’m trying to show all project numbers that do not contain employee id’s of 114 and 113 (the application designers). Looking at the table data, I can see without writing code that the project numbers are
How can I add an object to my table with multiple values?
We have a postgres setup, and I’ll be honest straight away I know very little about database manipulations, my goal is to add an object to the pre-existing table called websites and then have the following object with properties as below: I know it’s quite easy to just add supportDesktop as a boolean property like so: I’m not sure if
Select row by user_id and any row which share that entry’s event_id
I have a table which includes the following format: _______________________________ | event_id | user_id | username | |——————————-| | 30 | 1 | user1 | | 30 | …
SQL – Divide One Query by Another
I am trying to create a query which returns the workout percentage completion… Workout Percentage Completion = ((Sum of LogEntries WHERE date = IN list of dates and WorkoutID =1 ) / (Sum of all set numbers WHERE WorkoutID = 1)) x 100 Below is what I currently have, at the moment it is only returning the result of the
How to update specific column with values from another table
I have a table called “bug_table” that looks like this: and a table called “bug_revision_table” that looks like this: Now comes the question: How can I modify the timestamp of each id from the first table with the latest/most recent one from the second table? As you can see, each bug_id can have multiple revisions with different timestamps. I’m only
How to find distinct columns in a nested subquery in SQL?
I need to find the distinct drinkers that ordered ‘VODKA’ and ‘WHISKY’. I AM ONLY ALLOWED TO USE A NESTED QUERY. No other format is accepted. I am quite new to sql so any help would be greatly appreciated! Here are the tables I am trying to retrieve data from: Here is my SELECT statement so far: INSERT STATEMENTS: DESIRED
How to use WHERE EXISTS in a SQL subquery?
I need to find the distinct drinkers who have ordered drinks at a pub on VICTORIA AVE. in March 2020. Here are the tables I am trying to retrieve data from: Here is my SELECT statement so far: Answer The subquery needs to be correlated to the main query in its WHERE clause.
SQL query is causing problem while inserting into table
I tried to insert dataframe using pymysql library. It’s giving this error: pymysql.err.ProgrammingError: (1064, “You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ”bestwebsites’ (‘Rank’,’Score’,’Category’,’Audience’,’URL’,’Links’,’Desc’) VALUE’ at line 1″) I tried using sqlalchemy It’s working Answer Column names (and table names) should not be
MySQL find column name where it’s value match the pattern
How to search the entire database for column name equal to my rule and specific value as well. Let’s say that i want to search for column name like voucher where it’s value contain that word value10 So far i can find the column name but i don’t know how to match with value as well. So the end goal