Select Where Result Is In String [closed] - mysql

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I would like to perform a SQL Select Statement where any text in the query is a result.
For example, if the query is 'Driving Directions to Dundee in Scotland' I want this result to be returned
id: 5
name: Dundee
description: Dundee is a City in Scotland
Location: 56.4640° N, 2.9700° W

For your particular example, you could use this where clause:
where $query like concat('%', name, '%')

Related

Find the max name [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
I need to find the sum of the names and then choose the bigger.
I need to show that the max name is John smith because it's 4 times.
I guess you need the most repeated name. You may try below query -
SELECT writer, COUNT(*)
FROM YOUR_TABLE
GROUP BY writer
ORDER BY COUNT(writer) DESC
LIMIT 1;

SELECT mysql query to get first 100 numbers (1-100) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
i want a mysql select query where i can get first 100 numbers starting from 1 and ending to 100 without CTE or any procedures just want a query only.
When I need a list of integers I use
SELECT help_keyword_id num
FROM mysql.help_keyword
HAVING num BETWEEN 1 AND 100
ORDER BY 1;

How to get customize date format in mysql [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 2 years ago.
Improve this question
I have a column named timee and data type is timestamp and the default value is current_timestamp.
My table looks like
id title timee
1 Abc 2020-10-31 00:31:47
2 Def 2020-10-31 00:35:50
I want to fetch data like
id title timee
1 Abc 31-10-2020
2 Def 31-10-2020
I tried select id,title,time from tableName but it's giving me the whole time but i don't know how to select just date and with dd-mm-yyyy format
Use date_format():
select id, title, date_format(timee, '%d-%m-%Y') timee
from mytable

SQL Display student record having maximum marks from other table [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 4 years ago.
Improve this question
student(sID,sNAME,sCLASS);
result(sID,subMARKS);
Actually, in MS-ACCESS, i am trying to this with equi join but getting wrong result. i'm writting my query like
SELECT stud.sID
, stud.sNAME
, stud.sCLASS
, result.sID
FROM student
, result
WHERE(SELECT MAX(subMARKS) FROM result)
It should display Ali record only because he is having maximum marks. but i am getting this kind of output as shown in picture below.
sID sNAME sCLASS
1 Ali BSC
2 Ahmad FSC
3 Asgar ICS
4 Akram BSC
SELECT T1.SID, T1.sname FROM student T1
LEFT JOIN resultT2 ON t1.sid=t2.sid
WHERE t2.submarks = (SELECT Max(submarks) FROM result);

Mysql Order By(sorting data) opposite gender first then same gender etc [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 6 years ago.
Improve this question
I want to sort users data according to multiple column's like
1. opposite gender then same gender
2. same city
3. same interest
select * from table where status=1 ORDER BY gender = '".$gender."' DESC, city = '".$udata['city']."' DESC, total_rcv_kisses DESC, interest IN ('".$udata['interest']."') ASC, age ASC limit ".$limit.",".$start;