1) This finds the japanese sign for dog (犬):
SELECT japanese
FROM edict
WHERE english LIKE 'dog'
LIMIT 1;
2) This finds all japanese words with the sign for 'dog' (犬) in it:
SELECT japanese
FROM edict
WHERE japanese LIKE '%犬%';
3) I am having trouble combining those two into one, because this doesn't work?!
SELECT japanese
FROM edict
WHERE japanese
LIKE CONCAT('%',
SELECT japanese FROM edict WHERE english LIKE 'dog' LIMIT 1,'%'
);
SELECT *, CONCAT(FIRSTNAME, LASTNAME) AS FIRSTNAME FROM demo_table; Output: Here, we can see that FIRSTNAME and LASTNAME is concatenated but there is no space between them, If you want to add space between the FIRSTNAME and LASTNAME then add space(' ') in CONCAT() function. This method will change the original table.
The CHECK constraint is used to limit the value range that can be placed in a column. If you define a CHECK constraint on a column it will allow only certain values for this column. If you define a CHECK constraint on a table it can limit the values in certain columns based on values in other columns in the row.
Parenthesises are important, therefore, try this :
SELECT japanese
FROM edict
WHERE japanese LIKE CONCAT('%',
(SELECT japanese FROM edict WHERE english LIKE 'dog' LIMIT 1),
'%');
It might have been good to tell us what error you received, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With