Skip to content

Tag: sql

MySQL automatic apostrophes any ideas?

Im trying to patch a value in my Database, but Im getting an error. Backend: Frontend: Error: “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ”important’ = 1 WHERE todo_id = 1′ at line 1″ SQL…

Retrieving row and column number from within a string in sql

I am trying retrieve row and column number for following strings. The numbers that follow the R are the row no and numbers that follow the C are column numbers. Also as you can see some of them are 4 digits and some of them are 3 digits. How do I use a single function to retrieve the row and

Remove the middle row of the SQL table

In My SQL Table store the Status record. There are 4 main status Open, New, Completed, and closed. There can be many New Status. But Open, Completed, and Close should only one status. But we can close status Reopen(ID 102) For the particular sequence SEQ column is the unique ID. we can consider ID and SEQ as …

SQL: Why do I not get the same output with the two queries below?

I am trying to find Students who got all possible different grades. If you receive an 18 you pass the course and the highest number is 30. Thus, if you have received 13 different grades which are higher than 17 you have in turn received all possible passing grades. The first query returns 0 rows and the secon…

Foreign key as primary key?

I currently have 2 tables STUDENTS and SUBJECTS. I need to create another table for ENROLLMENTS, the thing is that in that table I need to know the minimal attendance, which is both dependent on …

Insert data into Postgresql with duplicate values

I need to insert dataset in postgresql. the problem is that there are many duplicate values in the request. As the result database should involve Or nothing if this dataset is in database. How should I make my query? P.S. The table is: Answer If you don’t want duplicates inserted, then add a unique inde…