简体   繁体   中英

how can i select all records from Campus table if the Campus name contain the “'Indiana” word?

I want select all records from this table if the Campus name has contain the “Indiana” word any place. It is not necessary to be at the first or last place just I need when the CampusName column contains the word "Indiana" (anywhere).

create table Campus 
(
CampusID int not null primary key
, CampusName varchar2(20) 
, Street VARCHAR2(30)
, City VARCHAR2(25)
, State  VARCHAR2(20) 
, Zip int
, Phone int 
);
insert into Campus (CampusID, CampusName, Street, City, State, Zip, Phone)VALUES 
('1','IUPUI','425 University Blvd.','Indianapolis', 'IN','46202','3172744591'),
('2 ','Indiana University ','107 S. Indiana Ave. ','Bloomington ','IN','47405 ', '8128554848'),
('3','Purdue University ','475 Stadium Mall Drive','West Lafayette','IN','47907','7654941776');

What I have so far:

select * from Campus where CampusName LIKE 'Indiana';

You need to use the wildcard '%' character before and after search text.

SELECT *
FROM Campus 
WHERE CampusName LIKE '%Indiana%'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM