How to subselect on multiple values where like operator is included? I build Table B with the ‘%’ to get all values from Table A with the like-operator. I can get the I-values from Table A with SELECT * FROM TABLE A WHERE VAL LIKE (‘I33.%’) but i build Table B to go through the whole t…
Tag: sql
Convert from sql query condition to REGEXP_LIKE
I am converting an SQL query condition like: I tried to execute query in Oracle using condition belove but no result return: Result look like for example 169011310 so _ are numeric characters Answer The $ in regex means end of string, you need to remove it because % in TSQL means any text, any zero or more ch…
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 th…
Sql server not updating records with nested case statement in a query
I’m using sql server 2012 and here is my query: it isn’t update my table just results couldn’t configure the issue even i tried a single query just like is there something which I’m doing wrong? or any other way to achieve my desired result? Answer is mandatory to write WHERE Column11 …
SQL Server: update rows that take part in grouping
I’m using SQL Server 2017 (v14.0). I have two tables with one-to-many relationship. I need to group the rows in the “Orders” table and by this info create the row in the “Transactions” table, then I need set the relationship – for a created transaction I need set the Transa…
What is the best schema for a many-to-many relationship in MySQL?
I need to design a database schema. My data is as follows: Product Id (Primary Key), Product Name (String), Product Type (String), Item Count (INT), Tags (Array of Strings) My requirements: I need to frequently query Products based on Tags. It is a many-to-many relationship – Each Product Id could have many T…
Is there a way to run posqresql queries in a pandas dataframe?
I have pandas dataframe like this : created_at lat long hex_ID 0 2020-10-13 15:12:18.682905 28.690628 77.323285 883da1ab0bfffff 1 2020-10-12 22:49:05.886170 28.755408 77.112289 883da18e87fffff 2 2020-10-13 15:24:17.692375 28.690571 77.323335 883da1ab0bfffff 3 2020-10-12 23:21:13.700226 28.589922 77.082738 883…
How to use REPLACE with WhereRaw eloquent laravel?
I have a column in my database that saved with double quotation (“) now I want to replace it by space.I’m using REPLACE and whereRaw.but It dosent work. this is my code: actually using / for scaping (“).Any Idea? Answer I believe you found the answer in the comments another thing what I sugg…
SQL Finding all elements which does not belong to a particular set, in many to many relation
I have problem with this task: Given are the relations Students: ST (S#, SNAME) Lecture: L (L#, LNAME, ECTS) Who attends what: LS (L#, S#) Find students (S# and SNAME) who do not attend any lecture having more than 4 ECTS I know that I can do it by checking whether the MAX value of ECTS for given student is
I am trying to use SQL to count the number of rows for each date in my database
My database is something like this: I only need the counts of the dates like this: I’ve tried … … but the date format is not my friend. Any ideas would be appreciated. Answer In most databases, you can remove the date component by converting to a date and using group by: However, various dat…