Question

What are the results of this query? Data in the table blof: ofcbldg -------------------- Building K...

What are the results of this query?

Data in the table blof:

ofcbldg
--------------------
Building K #112
#115 K
Office K#114

Query:
SQL>  SELECT SUBSTR(ofcbldg,instr(ofcbldg,'#')+1,3) 
  2 FROM blof;
0 0
Add a comment Improve this question Transcribed image text
Answer #1

SELECT SUBSTR(ofcbldg,instr(ofcbldg,'#')+1,3) 2 FROM blof;

instr(ofcbldg,'#') will find the position of # character in the ofcbldg column

instr(ofcbldg,'#') + 1 is the first argument of SUBSTR function and second argument is 3

So SUBSTR will extract the 3 characters from the column ofcbldg starting from the character after # character

There are 3 rows in the column ,so values extracted will be :

112

115

114

and the new calculated column name is 2

2

----

112

115

114

Do ask if any doubt. Please upvote.

Add a comment
Know the answer?
Add Answer to:
What are the results of this query? Data in the table blof: ofcbldg -------------------- Building K...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What is a front-end solution? Building a table such that a query need not write a...

    What is a front-end solution? Building a table such that a query need not write a condition to isolate itself (so you could just dump the contents of a table and it would naturally answer the question) An attempt to manage a database process (usually data entry to a standard) without using database programming techniques in SQL A constraint in SQL only levied when using a query

  • Write an SQL query A related table to snp151 is named snp151CodingDbSnp, which stores data about ...

    write an SQL query A related table to snp151 is named snp151CodingDbSnp, which stores data about changes in protein sequence related to SNPs. For this query, you will extract data from both tables using a join. The query results should have the SNP name, chromosome, strand and start position from the snp151 table, AND the transcript, codons & peptides from the snp151CodingDbSnp table. Q2: Modify Q1 to only include SNPs that are in frame 2. Q3: Modify Q2 to only...

  • emp table in bellow: 5. Query data from emp table for each non-deptno 20 employees to...

    emp table in bellow: 5. Query data from emp table for each non-deptno 20 employees to display the ename and calculate the number of months between today and the date the employee was hired. Label the column heading to Ename and Months_Worked. Order your results by the number of months employed. Round the number of months to a whole number. Months _Worked - - - - - - - - Ename MILLER KING JAMES MARTIN TURNER CLARK BLAKE WARD ALLEN...

  • Answer all questions The statement Like "A?9 can be used as a query criterion to match...

    Answer all questions The statement Like "A?9 can be used as a query criterion to match several field values. List any one example of a field value that would match this criterion. 3. What specific type of query would use the following criterion? Like [Enter name:] & 4. What aggregate function would be used to output the number of nonnull field values in a crosstab query? 5. 6. The value Is Null would be used as a criterion in which...

  • 1. Given the table above, write an SQL Query that will select only those individuals that...

    1. Given the table above, write an SQL Query that will select only those individuals that scored 800 or higher, sorted by last name in ascending order. 2. Given the table above, write an SQL Query that will add a new entry for John Smith with a score of 834. The field id is auto incrementing. 3. Given the data below, write an SQL Query that will delete any values where the score is below 740. id Fname Lname Score...

  • Write a query to find all product names from Production.Product table. with the list price greater...

    Write a query to find all product names from Production.Product table. with the list price greater than $3,000. Use SQL select statement.

  • Database For this lab you will be using SQL SELECT statements to query your database tables....

    Database For this lab you will be using SQL SELECT statements to query your database tables. You will be turning in the results of the following queries: 1. List all Patients and what Bed they are assigned to 2. List all patients who had Treatments and what Treatment they received 3. List all patients who had tests and what Test they had 4. List the employees (doctors, nurses, etc.) who assisted each patient. 5. List all patients in alphabetical order...

  • DATABASE SYSTEMS PLEASE HELP ME FOR QUESTIONS 1 THRU 2 SHOW THE QUERY AND THE RESULTS...

    DATABASE SYSTEMS PLEASE HELP ME FOR QUESTIONS 1 THRU 2 SHOW THE QUERY AND THE RESULTS OF THE QUERY (OUTPUT IN TABLE). ALSO, SHOW THE COMMANDS TO CREATE EACH TABLE (DDL COMMANDS) AND THE INSERTION OF THE DATA FOR EACH TABLE (DML COMMANDS). Question 2: SQL (40 points) Use the following database to answer all parts of this question: Table: EMP Primary Key: E NO E NO E NAME E DEPT E RATHE $400.00 $200.00 $150.00 $150.00 S120.00 $100.00 $100.00...

  • create table sql query and insert data sql query for the below - VehicleType(make, model, doors,...

    create table sql query and insert data sql query for the below - VehicleType(make, model, doors, body,trim) Vehicle(regNum, fleetNum, colour, make,model) ScheduledService(date,kilometrage,regNum,depotId) ServiceHistory(date,cost,description,regNum,depotId) Records(make,model,tariffId,rentalPrice) DailyTariff(tariffId, conditions) Invoice(invoiceId,qualityCheck,datePaid,finalCost,date) Insurance(insuranceId, policyType, cost) Insures(insuranceId,date,policyNumber) HiredVehicle(date, cardType, cardNo, kilometrage, days,tariffId,clientId,depotId,regNum) Depot(depotId, street,postcode,phone,fax) Booking(startDate,hiredays,colour,depotId,make,model,clientId) Client(clientId,street,postcode,phone) PersonalClient(clientId, fName, lName, title, driversNum) CompanyClient(clientID, cname) underlined are primary keys and italicised are foreign keys.

  • Using the Cash table below, show the output for the following SQL query: (Using the dropdowns,...

    Using the Cash table below, show the output for the following SQL query: (Using the dropdowns, identify which rows and columns would included in the SQL query output shown below. Select "Not included" for rows and columns that would not be included in the output.) SELECT Account#, Balance FROM Cash WHERE Bank = ‘Boston5’ ORDER BY Amount DESC; Cash Account # Type Bank Balance 253 48.000 75,000 950 Checking Checking Draft Checking ncluded BA-6 BA-7 ot Included BA-8 BA-9 Boston...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT