concatenation - Create view to allow certain fields - SQL -


my table includes fname,lname,studentid,major1,major2,minor attempting create 2 different create view tables different restrictions. first one, view table need show me names of students majoring in business classes. how able query include example - eco, fin, acc not include non-business majors example bio, chem.

create view a7t6 select fname || ' ' || lname "student", studentid "id", gpa, upper(minor) "minor" a7 

what statement be?

since question includes 2 major columns "major1" , "major2", might require minor modification gurv's script. e.g.:

create view a7t6 select fname || ' ' || lname "student",     studentid "id",     gpa,     upper(minor) "minor" a7 major1 in ('eco', 'fin', 'acc') or major2 in ('eco', 'fin', 'acc'); 

for non-business case, might better alter clause use not in rather enumerate possible negative cases:

where major1 not in ('eco', 'fin', 'acc') , major2 not in ('eco', 'fin', 'acc'); 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -