-3

I'm using oracle plsql and I have a question. I have table of Tests and Table of Schools.

How can I make a query that will put null or some other by my demands?

I mean, to put null or some numeric number in the execution.

PythIsReal
  • 41
  • 1
  • 2
  • 8

1 Answers1

0

Maybe something like this:

Schools-table

create table schools (name varchar(20));

insert into schools values ('Harvard');
insert into schools values ('Oxford');
insert into schools values ('Cambridge');

Tests-table

create table tests (name varchar(20), school varchar(20));

insert into tests values ('Math', 'Harvard');
insert into tests values ('Math', 'Oxford');

Left join

select
    s.name,
    t.name
from
    schools s
left join
    tests t on t.school = s.name;

Output

|      name |   name |
|-----------|--------|
|   Harvard |   Math |
|    Oxford |   Math |
| Cambridge | (null) |
unitario
  • 6,295
  • 4
  • 30
  • 43