These are the given tables: Question is: Write a optimized query to find out the name of all the customerIDs who ordered coffee that originated from ‘Costa Rica’ or ‘Indonesia’. My attempt: My teacher says it can be optimized more but I don’t see any way. Please Help me out. Answer Rather than these nes…
Tag: mysql
How to Insert C# values to MySql?
I want to insert C# winform values to Mysql there are 3 columns name,id are TextBox text and gender is ComboBox value but there is error and error messsage said: MySql.Data.MySqlClient.MySqlException:…
How to insert yes or no value into flag column based on regex query
I have a simple update that works great work analyzing a US based telephone number. It correctly inserts a Y in the phone_flag column based on the following query. UPDATE database.table SET phone_flag …
How to substract 2 columns from different table with using count function? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question Currently, I am using count function to calculate the value for 2 columns and wanna substract…
How to get the size of the duplicates in this query?
Let’s say I have the following data: I want to find out how much data I have in duplicates — that is — if we have one of each of the files (unique by md5) how much space do we save? The answer should be: Here is the base query I have thus far: I think the simplest way to
How to exclude certain entries from a query [SQL]
I do have the following issue: Let’s say you have a table that looks like this: Question: I want to have an query which will deliver all the NotPrimID’s which do have the Number as 13, however if the Number of a NotPrimID is also 14 etc. it should be automatically excluded from the list. Answer Yo…
When selecting data with DATE_FORMAT() is not getting proper values MySQL
I’m having a table structure as below. insert statements : when i select with below query I’m not getting the proper out. Output : I need a data where dt values are less than 90 Days. Can anyone suggest where to make changes. Answer You are overcomplicating things here I think. Basically you are t…
Is there a way to convert this query into Oracle query using merge statement?
Answer I think this does what you expect. Without table structures and sample input data it is not possible for me to test it.
MySQL Join Over 5 tables
The Situation We have these 5 different MySQL tables: Table club Id | ClubName | CityId —+———-+——– 1 | Test | 1 Table city Id | CityName | CountryId —+———-+———– 1 | …
Remove null values in MySQL and combine non null values into one cell
Hello guys? I have a MySQL table storing timetable classes, a specific subject is allocated to a specific timeslot stored in columns. I have no issue when there are no two subjects taught at the same time since I use max() to select from the time table i.e The above query gives me this results Now from the fi…