Skip to content

MySQL Combine Group by Column

I am new to SQL statements so my wording per my request may be incorrect, so I will provide a lot of detail to better understand my issue. I have a database table called workouts that looks like this: id bodyPart gifUrl name target broad_target 1 back http://d205bpvrqc9yn1.cloudfront.net/0007.gif alternate la…

How to fix cache lookup failure/corrupted database?

I’ve got a postgres database that I’m trying to clean up with drop schema public cascade. The data on it is not that important and I never made any backups. I’m just trying to rebuild it. However, it seems an error I made earlier is causing the drop command to fail. When I run drop schema pu…

MYSQL table wont allow multiple foreign keys

I know this has been asked again and again, and I’ve tried so many times and don’t understand why I keep getting errors, but I’m trying to connect the order details table to the order items, users and payment table, but SQL is coming up with. (this is for a school project) I’ve been ab…

select subset of rows

I have the following table I want to write a query that ignores the rows with the latest DATE for each NAME No idea how to write a query like that…. Answer You can use rank() to rank the rows by descending DATE, then filter out rows with rank = 1 : Fiddle

How to convert this string into timestamp in postgresql?

I want to convert a string into timestamp I am using the following command for it However it is returning me ‘2023-07-17 23:38:02’ this instead of ‘2021-31-12 23:38:02’ Answer Place of month & day in the input string doesn’t match format string. Use: As pointed out in the com…

Bulk insert csv file with semicolon as delimiter

I’m trying to import data from semicolon separated csv file into a SQL Server database. Here is the table structure The csv file is shown below: There are some columns that I don’t need, so I create a format file to import the data. The format file is shown as below Then I tried both bulk insert a…