Record query under partial value conditions - SQL skill sharing
P粉588660399
P粉588660399 2024-04-06 16:01:26
0
1
593

I have a table named zipcode which has a column named code. The Code column contains the prefix of the zip code, for example

395
453
302
1203
12

I want to write a SQL query that checks if the provided zipcode matches a certain value in the table. (Similar to isValid)

I want to avoid writing all zip codes in the database.

Valid entered postal code

395004
395152
3952
1256

Can anyone help me? Thanks

P粉588660399
P粉588660399

reply all(1)
P粉442576165

Simple SQL query:

select * 
from zipcode 
where '395004' LIKE CONCAT(code,'%');

Reference:SQL - Query if a string contains part of a column value

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template