1 Replies - 4860 Views - Last Post: 03 October 2012 - 01:01 AM

#1 TinkerTailor  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 10-January 12

Oracle SQL SELECT FROM WHERE column name sentence contains a word

Posted 23 September 2012 - 02:27 PM

So I've just started a database course this semester in Oracle and my second assignment has me stumped on the first question.

We've been given a table that has been filled with data:
CREATE TABLE Hotel
(hotelNo        NUMBER(4)    NOT NULL
,hotelName      VARCHAR2(16) NOT NULL
,hotelAddress   VARCHAR2(40) NOT NULL
,PRIMARY KEY (hotelNo)
);
.... other tables don't directly affect question 1



For all hotels in London, list...

The example SQL that I was told to use by my instructor is:

SELECT *
FROM Hotel
WHERE hotelAddress LIKE 'London';



When I run the table creation and fill the columns with data, I run the above SELECT code and it says "no rows selected". I'm not sure how, without the use of REGEX, I'm supposed to find the columns that contain London at the end of the address.

The hotels that contain London in the address (which have already been created) are as follows:
INSERT INTO Hotel
    VALUES (1, 'Grosvenor Hotel', '100 Oxford Road, London');
INSERT INTO Hotel
    VALUES (3, 'Holiday inn', '56 Edinburgh Square, London');
INSERT INTO Hotel
    VALUES (9, 'Royale London', '500 Cambridge Road, London');



Is my SELECT code missing something that I just can't find?

Is This A Good Question/Topic? 0
  • +

Replies To: Oracle SQL SELECT FROM WHERE column name sentence contains a word

#2 idunno  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 10-October 11

Re: Oracle SQL SELECT FROM WHERE column name sentence contains a word

Posted 03 October 2012 - 01:01 AM

just add LIKE '%London'
i dunno what % is it called as my name implies
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1