Skip to content

Tag: mysql

How to see hidden or escape characters inside a varchar column?

Using MySQL 5.6. I have a varchar column that stores addresses as text. When they come through to my application into a text area box, they are spaced appropriately, like I tried inserting a new address directly into the database but it doesn’t work correctly inside the GUI, it all came in as one line w…

show who resit and passed and what course was it?

i need help find who fail in exam & resit and pass the exam only, heres the code: heres the result: I need find like this: Answer Possibly using a query like below. this is using your query as input. Also we have assumed that it is not possible to have a student have (PASS, FAIL) for a student on

Select with joins in a unique table system

I am trying to build an SQL query on an omekaS database to extract books with a specific title and date. In this system, the table holding the values is called value, and the relevant attributes are as so : The resource_Id is the identifier through the db Value is one field; like the book “Moby Dick&#82…

MySQL alternative way to `CASE` Statement

May I know, is there any alternative way or short way to write this case statement shown in the below: I tried using mysql built in funciton ifnull as below: ifnull(p.our_price,p.sales_price) But it doesn’t work for me. Answer You could stick with a CASE expression but use COALESCE to make it more succi…

Does the column order matter in a WHERE SQL statement

I’m working on a system with a good amount of indexes. Some indexes are simpler than others. I.e. they’re INT, VARCHAR, DATETIME and in some cases ENUMS(maybe 5~25 variations). Does the WHERE order matter? In other words, would placing the easier to search columns first increase speed/performance?…