I allow myself to write a thread regarding a query I’m trying to make for hours now. I’m trying to get the name of the friend (friend.first_name) who refuses the most proposed dates for events. To do this I’m counting the number of proposed date and ORDER BY ASC. However, this does not take into account TIES. What I’m looking
on SQL can I have a ratio column based on a count of multiple parameters?
On this query here, I get the following result in the image provided below. However I want to take it a step further and turn the count into a ratio of wins / total wins. However when I use the second query (at the bottom) I get an error invalid use of the group function. To explain, the count is
MYSQL Trigger not adding count after inserting rows into another table
This is a continuation of this question: Insert data into a table with a foreign key SQL I need to create a trigger that updates a counter variable after I insert a row into a table. The counter variable keeps track of how many new rows are inserted into the ItemBook table. However, after running the script, the trigger doesn’t
SQL mixed String with leading zeros
I want to get the maximum value of a table and then add that with +1. The problem here is that the column contains leading zeros and the length of the column cannot be greater than 4. Here an example: Tablename: car id C001 C002 … C009 I have tried to solve this problem with this sql Query: result: C0010
select all passengers that landed in Palma de Mallorca or Barcelona but not both
I have to create a statement that fulfills the following requirement: Provide a list of all passengers who have landed either at the airport “Palma de Mallorca” or in “Barcelona”. But by no means on both. with this database: Flughafen-database this is what i came up with: but that throws the following error: An error occurred when executing the SQL
How would i restrict the company table to only allow each companyID to 10 countries?
This is my answer at this point, if this is correct can someone give a more in depth explanation as I am trying to teach myself SQL/ or point out how wrong I am kind regards, new SQL user. PS. I understand i can use a check constraint or a check trigger but I am trying to do this in
What’s the equivalent syntax in MySQL for selecting date ranges by YEAR based on MSSQL syntax?
I have a MSSQL syntax to select date within 2 years: This works fine, column_1 only return date within two years of the given date. However, I’m trying to convert it to MySQL syntax, here’s what I have tried: But this returns dates not only within two years range but also other years, am I missing something here? Thanks. Answer
MySQL Workbench – SELECT is not valid at this position with this server version when using CASE WHEN statement [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 11 months ago. Improve this question When implementing a basic CASE WHEN statement in MySQL Workbench, I am getting the following error “SELECT is not valid at this
How to have MySQL return multiple column of values based on a different benchmark?
I have a MySQL database table (sales) consisting of sales data with their dates. I have a SQL query that relies on a specific date benchmark. This query supposedly returns only one numeric value. Now I set the condition to be dependant on the benchmark. The problem is, I don’t want this benchmark to stay constant. I need the query
Writing SQL Queries Workbench
I’m having some trouble with writing this query. This is what I have so far: Find the name of the customer that deposited the highest amount with one transaction (include the transaction amount). …