Create view of CPU cost

Hello

I am trying to create a view with the following query:

CREATE OR REPLACE VIEW CPU_COST_V AS

SELECT

s.UserName,

t.SID,

s.Serial #.

Sum(value/100) as '(seconds) CPU usage.

Of

v$ session s,.

v$ sesstat t,.

v$ statname n

WHERE

t.STATISTIC # n.STATISTIC = #.

AND

NAME like ' % CPU used by this session %.

AND

t.SID = s.SID

AND

s.Status = 'ACTIVE'

AND

s.UserName is not null

GROUP BY username, t.sid, s.serial #.

/

The view will be the user of the SYSTEM, but I get the following error when you try to create the view:

ORA-01031: insufficient privileges

I have granted all previllages user SYSTEM.

Thanks in advance.

Find out on the user table

CREATE or REPLACE VIEW TEST_VW as

Select empno, emp;

Discovered on the dictionary object

CREATE OR REPLACE VIEW CPU_COST_V AS

Select the USER name from V$ SESSION;

You are able to create a point of view?

Can you be required

GRANT SELECT ON V_$ SESSION to .

GRANT SELECT ON V_$ SESSTAT to ;

GRANT SELECT ON V_$ STATNAME to ;

Tags: Database

Similar Questions

  • Creating views for DB XML content in Oracle 9i (9.2.0.4.0)

    Hello

    Please excuse my ignorance but I searched on through reams of documentation on Oracle XML DB and is extremely difficult to get information about a specific version when it evolved as radically. I develop on Oracle 9.2.0.4.0 (I'd be happy to upgrade but unfortunately my clients are less enthusiastic!).

    My questions are how and why I would create views of the XML data to use in my application. I made a snippet of XML data (according to an XSD) that I need to load into the database and then provide view in read-only data. I managed to save my drawings and insert the XML into the underlying structures of the object relationship and I now need to create views.

    For as much as I can muster in 9i I must query XML data using extractValue, for example:
     
    SELECT extractValue(xseq.column_value, '//ReferenceNumber') REFERENCE 
         , extractValue(xseq.column_value, '//ProviderName') PROVIDER_NAME 
    FROM   EXTRACT e 
         , TABLE(XMLSequence(extract(VALUE(e), '//Registration'))) xseq; 
    I also managed to get the same results by directly accessing the column 'hidden ': XMLDATA
     
    SELECT xml."ReferenceNumber" REFERENCE, xml."Provider"."ProviderName" PROVIDER_NAME 
    FROM   EXTRACT e 
         , TABLE(e.xmldata."Registration") xml 
    Issues related to the:
    (i) they are the only options I have to access the XML data in Oracle 9i? (XMLTable() looked quite interesting, but was unfortunately introduced in 10g)
    (II) given that I only need a read-only view of the data, are there benefits (other than speed) to be stored in object-relational tables as opposed to a CLOB?
    (III) is there a problem using the second method (cleaner) in relation to the first?

    Thanks a lot for you help,

    Tom Casserly

    (I) Yes. I'm sorry.
    (II) speed is the main advantage for storage GOLD regarding lead content (instead of CLOB--> pilot document by) queries. Other things I can think of is that it comforms to an XML schema, which is an advantage (you know that obey your XML file is the format defined) and a disadvantage (validation / grinding / and internal indexing off XML data will cost you performance).
    (III) it is (I think) not supported, less efficient then TABLE (XMLSequence (extract ()))

  • creating views in a new scheme to access some rows of the tables in the source schema

    Hello

    Oracle 10.2.0.4

    We try to hide some data from some users. My suggestion is that we create a new view_schema scheme on the same instance where we said the source tables in source_schema.

    We then create views in view_schema as below

    CREATE VIEW AS SELECT * FROM source_schema.table where COLUMN_n = "XYZ";

    We then grant SELECT on these views to a role and assign this role new users to be able to consult the data consulted.

    If the questions below.

    1. We can create views to view the data in another schema WITHOUT giving SELECT permissions on source_schema.tanle directluy?
    2. It works and there is no need to create synonyms etc.
    3. YOU can manage users and much easilier view (s)

    Is there a sense and who better than the selection seen with say table_name_view in the source schema to this effect and even the creation of synonyms for these points of view with the same name, yasmina in sourece_schema?

    Thank you

    905989 wrote:

    Hello

    Oracle 10.2.0.4

    We try to hide some data from some users. My suggestion is that we create a new view_schema scheme on the same instance where we said the source tables in source_schema.

    We then create views in view_schema as below

    CREATE VIEW AS SELECT * FROM source_schema.table where COLUMN_n = "XYZ";

    We then grant SELECT on these views to a role and assign this role new users to be able to consult the data consulted.

    If the questions below.

    1. We can create views to view the data in another schema WITHOUT giving SELECT permissions on source_schema.tanle directluy?
    2. It works and there is no need to create synonyms etc.
    3. YOU can manage users and much easilier view (s)

    Is there a sense and who better than the selection seen with say table_name_view in the source schema to this effect and even the creation of synonyms for these points of view with the same name, yasmina in sourece_schema?

    Thank you

    1. you can create the view in another schema (first granting of privileges to the schema of the view) without granting privileges of the schema of the source

    2. you probably want to create public synonyms for the view (s).  You can refer to the view as schema.view, but it's bulky

    3. I'm not sure management is easy, but the extra complexity shouldn't be too bad.  Write the documentation describing how everything works and the object involved.

    Another, more complicated, but more powerful option is to use row-level security also known as the virtual private database - if you have the license.  You create a profile for a table and a procedure to generate the WHERE clause to filter a query against the table and the columns defined in the profile.  Yet once, you need license to do this.

  • 'Create View' too long

    Hi all

    When I run the command 'create view', it takes a lot of time on Oracle 10.2.0.5. I tried a configuration for tuning but does not reach to the solution. You can find some information about my request.

    CREATE or REPLACE FORCE VIEW vcg.vw_as_po AS SELECT...

    SQL > select event, total_waits, Total_timeouts, time_waited, max_wait from v$ session_evenement where sid = 16321; *

    EVENT, TOTAL_WAITS, TOTAL_TIMEOUTS, TIME_WAITED, MAX_WAIT
    Journal sync files, 1, 0, 0, 0
    DB file sequential read, 60, 14, 0, 1
    cursor: hand S waiting on X, 26287 26287, 25787, 1
    SQL * Net message to client, 43, 0, 0, 0
    SQL * Net more data to the client, 10, 0, 0, 0
    SQL * Net client message, 43, 0, 78472 26872
    SQL * Net more data from client, 3, 0, 0, 0
    events in other waitclass, 48, 48, 45569 977

    SQL > select event, seconds_in_wait, wait_time, session state $ v where sid = 16314; *
    EVENT SECONDS_IN_WAIT - STATE - WAIT_TIME
    initialization of xdb 312 0 pending schema cache

    What can be the reason of this latency? Do you have any idea?

    Thank you...

    ozgurumut wrote:
    Hi all

    When I run the command 'create view', it takes a lot of time on Oracle 10.2.0.5. I tried a configuration for tuning but does not reach to the solution. You can find some information about my request.

    CREATE or REPLACE FORCE VIEW vcg.vw_as_po AS SELECT...

    SQL > select event, total_waits, Total_timeouts, time_waited, max_wait from v$ session_evenement where sid = 16321; *

    EVENT, TOTAL_WAITS, TOTAL_TIMEOUTS, TIME_WAITED, MAX_WAIT
    Journal sync files, 1, 0, 0, 0
    DB file sequential read, 60, 14, 0, 1
    cursor: hand S waiting on X, 26287 26287, 25787, 1
    SQL * Net message to client, 43, 0, 0, 0
    SQL * Net more data to the client, 10, 0, 0, 0
    SQL * Net client message, 43, 0, 78472 26872
    SQL * Net more data from client, 3, 0, 0, 0
    events in other waitclass, 48, 48, 45569 977

    SQL > select event, seconds_in_wait, wait_time, session state $ v where sid = 16314; *
    EVENT SECONDS_IN_WAIT - STATE - WAIT_TIME
    initialization of xdb 312 0 pending schema cache

    What can be the reason of this latency? Do you have any idea?

    Thank you...

    It seems that the view implies distance DB (@DB_LINK)
    Is this correct?

  • Long 'Create View '.

    Hi all

    When I run the command 'create view', it takes a lot of time on Oracle 10.2.0.5 and Db mode's physical Standby (reading / writing). I tried a configuration for tuning but does not reach to the solution.

    What can be the reason of this latency? You have any ideas?

    B.R.

    Published by: ozgurumut on 6 March 2013 01:03

    EVENT, TOTAL_WAITS, TOTAL_TIMEOUTS, TIME_WAITED, MAX_WAIT
    events in other waitclass, 48, 48, 45569 977

    "I can say here, sucks * waticlass other events ', which is related to the closure.
    You should take a look at what are the objects that the view made reference, use create view command, check all the locks before that.

    This is unrelated to the issue of data protection, if you have more question if please close this thread as answered here and open in General Question.s forums

    Thank you.

  • Privilege 'Create View' has been removed from the role of "Resource" why Oracle?

    Sounds like a silly question, but does anyone know why?

    >
    HM... deprciated and replaced by what? I know that they trimmed CONNECT much but only create view seemed lacking in RESOURCES.
    >
    Replaced by NOTHING. They have not just 'trim' CONNECT. He now has only the CREATE SESSION privilege.

    Published only info I've seen are these two notes in the Oracle is the database of the Security Guide.
    http://docs.Oracle.com/CD/B28359_01/network.111/B28531/authorization.htm
    >
    Note:
    Each facility must create its own roles and assign only those privileges which one needs, so to keep detailed privileges in use control. This process eliminates also any need to adapt existing roles, privileges or procedures, whenever the Oracle database changes or removes the roles of Oracle database sets. For example, the role CONNECT now has only a single privilege: CREATE THE SESSION. CONNECT roles and resource will be deprecated in the future the Oracle database releases.
    . . .
    Note:
    Visitors should stop by using the CONNECT and RESOURCE roles, because they will be obsolete in future versions of database Oracle. The role of CONNECTION currently maintains only the CREATE SESSION privilege.

  • Table alias when creating views in KM

    Hi all
    When an interface running I noticed that he failed on stage - LKM
    Create View on the Source

    (LKM MSQL to MSQL)

    On the survey, I found the error was due to an invalid alias in (created alias is a keyword in sql server) that ODI had attributed to the source table. I have extracted the code from the KM and I am hoping someone could point me on how I could change the KM for the ODI alias creates is different what its currently set to.

    TIA
    MN

    MN, you don't need to change the KM, when you click on the required data store, you will find the alias name, it change accordingly, or in the data store itself. I think that should help you.

  • CPU costs are off (think of it allowing)

    Hello

    I use Oracle 10.2.0.3.

    Whenever I generate explain plan for any query, last line of explain plan is as below.

    cpu costs are off (think of it allowing)_

    It seems that optimizer has not considered its CPU stats while generating plan for it.

    How to activate CPU here statistics?

    Optimizer_mode parameter value is 'CHOOSE', and his stats are collected at an interval of one week.

    When I use the CPU_COSTING flag in the SQL, then this line went, and the query plan also started giving the % of CPU output of the PLAN. But how can I do cela a default behavior of the optimizer (any setting etc are fixed in oracle 10g for this)?


    Thanks in advance.

    Best regards
    oratest

    See if the "_optimizer_cost_model" (Note underscore) has been configured in your pfile/spfile file.
    To CHOOSE or CPU.

    This setting is different from OPTIMIZER_MODE.

    Hemant K Collette

  • Error in creating view

    ASIF_SELECT is a use of data with the right to select on a table and have roles CONNECT and RESOURCE, after the newspaper if it run after declaration, there is no problem, but when it tries to create view of it give error ORA-01031 insufficient privilege and show * on general_information.cb_region_fo d.
    If I give her mistake to SELECT a TABLE ALL privilege withdraw, we cannot give this privilege. How do I solve this error

    SELECT DISTINCT c.br_region_fo_code AS region_code,
    d.NAME,
    SUM (c.employer_contribution) OVER (PARTITION BY c.br_region_fo_code) AS emp_contr,
    SUM (c.emp_arrear_amount) OVER (PARTITION BY c.br_region_fo_code) AS emp_arrear
    OF core_business.cb_contr_emp_pmt_slip c,.
    general_information.cb_region_fo d
    WHERE c.br_region_fo_code = d.region_fo_code
    ORDER BY c.br_region_fo_code;

    CREATE OR REPLACE FORCE VIEW ASIF_SELECT. A1A2 ACE
    SELECT DISTINCT c.br_region_fo_code AS region_code,
    d.NAME,
    SUM (c.employer_contribution) OVER (PARTITION BY c.br_region_fo_code) AS emp_contr,
    SUM (c.emp_arrear_amount) OVER (PARTITION BY c.br_region_fo_code) AS emp_arrear
    OF core_business.cb_contr_emp_pmt_slip c,.
    general_information.cb_region_fo d
    WHERE c.br_region_fo_code = d.region_fo_code
    ORDER BY c.br_region_fo_code;

    "CORE_BUSINESS" gave an explicit SELECT on cb_contr_emp_pmt_slip and cb_region to ASIF_SELECT? If the right to SELECT had been granted to a role and the role of ASIF_SELECT, the ASIF_SELECT can run a SELECT statement on the tables but can not run a CREATE VIEW.

    The CREATE VIEW requires explicitly privilege SELECT on the source tables.

    Hemant K Collette

  • Problem creating view with parameters

    Hello

    I'm new with PL/SQL and I am trying to create a view that accepts parameters. I have two tables that I merged with UNION first of all, I would like to notice what to do with the query parameters. It looks like this:

    TABLE 1
    col1,
    col2,
    COL3

    TABLE2
    col1,
    col2,
    col3,
    COL4,
    col5

    View:
    CREATE VIEW ALL_ADM_VIEW AS SELECT COL1, COL2, COL3 FROM
    (SELECT COL1, COL2, COL3 FROM TABLE1
    UNION COL1, COL2, COL3 FROM TABLE2
    WHERE CURRENT_DATE IN TABLE2. COL4 AND TABLE2. COL5) U
    WHERE U.COL3 = 'PARAMETER';

    I need to put the value of the parameter 'PARAMETER' for the view. Any help?

    Thanks in advance

    Create your view like this:

    CREATE VIEW ALL_ADM_VIEW AS
    SELECT COL1
          ,COL2
          ,COL3
    FROM   TABLE1
    UNION
    SELECT COL1
          ,COL2
          ,COL3
    FROM   TABLE2
    WHERE  CURRENT_DATE BETWEEN COL4 AND COL5
    ;
    

    When you use the view in your code, this is where you use your variable:

    select ...
    from   ALL_ADM_VIEW
    where  COL3 = 'PARAMETER';
    
  • create view does not work with the role of resource

    I just upgraded from 10.2.0.1 to 11.1.0.7

    the role of resource users could create views on the old database...
    now, they can't
    ORA-01031 insufficient privileges

    I have to give them create it all discovers the system privileges

    (1) I assume you mean that you gave them the CREATE VIEW privilege. Not CREATE ANY VIEW. The latter would allow them to create a view owned by another user who would be dangerous enough.

    (2) it is not related to the role of RESOURCE. It is almost certainly related to the CONNECT role. CREATE VIEW (among other privileges) has revoked the CONNECT role in point 10.2. I don't know why your 10.2 database was working, I guess that you updated from an earlier version, in which case the update may not have removed the privilege correctly (see Metalink: 317258.1).

    (3) you certainly don't want to use the CONNECT role or RESOURCES in the application of the production. Were the roles of the sample which have been overloaded with privileges for the various elements of the sample code. You should really create your own roles with of whatever your users must actually rather than using these predefined roles of privileges.

    Justin

  • How to create views in OBIEE?

    Hello world

    I'm new to OBIEE. My requirement is I have to apply different filters each column in a report. But if I apply no matter what filter it is the application of all the columns.

    For example, the column of my report is something like

    StudentsPassed | StudentsFailed | StudentsTrasnfered

    So I need pick up on a column in the State and need not to show that a particular result based on the status column. But if I select for status = StudentsPassed then all three columns im getting only students passed.


    So what I have is that I have created individual views for each column. IE View1 held that the list of students managed view2 held only the list of students failed. But now I need to generate multiple reports of the same type. So, I don't think it's a better idea to create views for each column in a database level report.


    Is there a method to do this?

    Is there a method to store only students Passsed list in a logical column in the level of the Administration?

    Please provide help.

    Thanks in advance,
    knani

    1. This is what you're doing wrong:

    New column object/logic/general tab/use existing logical column as a source.

    and you choose the column RULE and writing COUNT (DISTINCT RULE)

    and after registration/check, you will receive ERROR:

    [38083] of the attribute "MEASURE1" defines a measure by using an obsolete method.

    You do not MEASURE1 set on the way that you did.

    2. you define MEASURE1 on this way:

    Type of new object/logic tab/data tab General/column

    Now in the tab type of data go to a logical source/edit/measure1 table and select the RULE table to part PHYSICAL TABLE column.

    After that in your logical column MEASURE1 aggregation type choose COUNT DISTINCT.

    That's all.

    This will give you COUNT (DISTINCT RULE).

    3. put the MEASURE1 in record presentation/table with CAT, RULE, and STATUS columns

    4. test answers

    FILTER (CAT_RULE_STATUS. MEASURE1 TO AID (CAT_RULE_STATUS. STATUS = 1))

    FILTER (CAT_RULE_STATUS. MEASURE1 TO AID (CAT_RULE_STATUS. STATUS = 2))

    FILTER (CAT_RULE_STATUS. MEASURE1 TO AID (CAT_RULE_STATUS. STATUS = 3))

    Result:
    2 2 1

    It's okay, you see how many separate RULES are inside each State (see our example with data).

    I did physical table (select) to this case:

    Select 1 as cat, 1 rule, 1 the status of double
    Union of all the
    Select 1 as cat, rule 1, 2 the status of double
    Union of all the
    Select 1 as cat, rule 1, 3 that the status of double
    Union of all the
    Select 1 as cat, 1, 2 as a rule that the status of double
    Union of all the
    Select 1 as cat, 2 2 status of double rule

    Concerning
    Goran
    http://108obiee.blogspot.com

  • create view force executes a select statement

    I have the following script, which is called during the installation as a user the_owner with @Code\Views\VW_TODO. from sqlplus
    Prompt View VW_TODO;
    
    CREATE OR REPLACE FORCE VIEW the_owner.VW_TODO (THE_ID, COUNT) AS
    --+============================================================================
    -- Project Code:  
    -- Project Name:  
    -- Module Type:   View
    -- Change History:
    --
    -- Name                 Version  Date        Comment
    --
    -- =============================================================================
    
         SELECT   the_id, COUNT ( * ) COUNT
           FROM   the_owner.todo_list
          WHERE   completed IS NULL
       GROUP BY   the_id;
    /
    I get the following output in my journal...
    View VW_TODO
    
    no rows selected
    
    
    no rows selected
    I have tried with and without the trailing slash and the final semicolon... no work...
    When I run SQL Developer, it creates the view.
    Can someone tell me why?

    Thanks in advance,
    Gus...

    Gus,

    It seems that you have a completely empty line in your CREATE VIEW statement. This will cause the statement fails. If please remove this line and try again.

    Andy

  • How to create views of data from different databases tables in2

    Using Oracle 10.2 g

    I have 2 databases Gus and the haggis on schema Comqdhb.

    Glink indicates a link of database between Haggis and Gus

    In Gus, there is school that contains columns with same name upn, grade, subject, student of tables...

    STUDENT
    UPN
    academicYear

    Object

    Object

    GRADE
    examlevel
    grade

    SCHOOL
    SN

    In HAGGIS raising tables, grade, teacher containing columns upn... desc below.

    STUDENT
    UPN

    GRADE
    grade
    UPN
    academicyear
    level



    Create views in your database HAGGIS who join their all the qualities of the review. You should have a point of view that will produce the following relationship:
    examGrade (upn, subject, examlevel, sn, rank, academicYear)

    So I need to create a view that gets the data from the tables in the databases.

    create view as examGrade (upn, subject, examlevel, sn, rank, academicYear) like some s.upn


    But I don't get the selection of a column of 2 tables in different databases

    I mean if I said

    Select the UPN in comqdhb.student@glink,comqdhb.student;
    Select the upn name in comqdhb.student@glink,comqdhb.student
    *
    ERROR on line 1:
    ORA-00918: column ambiguously defined

    Help me, thank you.

    Hello

    Rider wrote:
    The issue is that I can't understand that I should create the view by the union of the haggis and the two gus data or only haggis.
    the reason I believe I need to combine the two is mentioned * "" create views in your database schema HAGGIS who join their all the qualities of the review. ". *
    By the mention of creating views and who join their all the qualities of the review, it probably means to obtain the data of the GUS and HAGGIS.

    This is my interpretation of the assignment, too.
    If you ask just the tables on Gus, you will get the ranks of three of the four schools: it's not all examination classes.
    If you ask just the tables on Haggis, you will get the ranks of any of the four schools: it's not all examination classes.

    2nd prob is that if have decided to create a view that gets the data from these two gus and therer haggis would be a lot of duplication involved due to the cross product

    Why would there be "repetition involved due to the cross-product"?
    If the quuery of Gus produces 100 lines, the request of product Haggis 30 rows, then the UNION of the two will have 100 + 30 = 130 lines (assuming, as you say, each student is at school only one).

    the query I wrote is

    Create view examGrade (upn, subject, examlevel, sn, rank, academicYear)
    as
    Select distinct s.upn as upn, g.subject as topic,
    g."LEVEL" as examlevel, g.grade as rank, to_number (g.academicyear) as academicyear
    of s comqdhb.student, comqdhb.grade g
    s.UPN, sb.subject, g.elevel, g.grade, s.acyr select Union
    of comqdhb.subject@glink sb,comqdhb.student@glink s,comqdhb.gradevalues@glink g;

    You should not write, not to mention not formatted zip code. I have a little time I can devote to answering questions in the forum. Do you want me
    b spend this time formatting your code, so I can understand the question, and no time to answer, or
    b spend only a little time reading understanding your code and spend most of my time to help you?
    I would prefer (b), but the choice is yours.
    See the statement that I posted in my last post for an example of the formatted code. You see how it appears in a box with a police fixed-width, and multiple spaces are printed? This is because I typed {code} (all small letters), before and after the section I wanted formatted.

    At least put each table in the FROM clause on a separate line, so it is easy to know if you have enough join conditions.
    If you have N tables in the FROM clause, you almost always have at least N-1 join conditions that specify how the tables are linked together. For example, if talk you about two tables, quality and student, you expect to see a join condition that tells you when you have data in a table, how to find related data in the other table, such as

    g_gus.upn = s_gus.upn
    

    No no no join conditions will cause "repetition involved due to the cross product.

    I downloaded my info here
    http://www.upload4free.com/download.php?file=44201983-School_ExamGrades.PDF


    http://www.upload4free.com/download.php?file=184648736-ExamGrades_Case_Study_2008FINAL.PDF

    Sorry, if there is data as long as you can't post here, there is much too much for me to read.
    Make a sample set, containing a few (maybe five) students and a few shades of each student. It is fine to copy a few lines of your actual data.

    That's all the time I have for today. I can't wait to get the data and formatted requests.

  • Create views on the owner assistance Board different pls

    I'm stuck with a problem kindly help me out I want to create a view by selecting certain columns of a table to a different owner. I have the privileges but I am unable to do things.

    Select the table table_name from all_tables where owner = "COMQDHB";

    annoys me

    TABLE-NAME
    ----------
    GRADE
    STUDENT
    TEACHER

    I want to create a view with only grade and student

    IAM able create the whole table view
    Create view v1 as select table_name from all_tables where owner = "COMQDHB";

    but when I try to create the view with the selected columns

    Create view v1 as select table_name (grade, student) all_tables where owner = "COMQDHB."

    also, I tried to create the view entire table and then removing the teacher column, but I do not know the appropriate syntax.

    change the view view_name remove teacher column;

    Hello

    I agree with John and David. What makes you think that there is a table, called table TABLE_NAME?

    When you make this request:

    select table_name from all_tables where owner='COMQDHB';
    

    and you get these results:

    TABLE_NAME
    --------------------------------------------------------------------------------
    GRADE
    STUDENT
    TEACHER
    

    tells you that there is a column called TABLE_NAME in the ALL_TABLES view.
    (When you perform a query, the result indicates the names of column above the horizontal line and the values below the line).
    The TABLE_NAME column contains the values "RANK", "STUDENT" and "TEACHER", which indicates that there are some tables with these names.
    If these three lines are the only exit from the query above, these three tables is the only tables belonging to COMQDHB, or at least the tables only three on which you (HAGGIS) have privileges.
    I want to create a view with only grade and student

    This point of view:

    create view v1 as select table_name from all_tables where owner='COMQDHB';
    

    shows a small subset of data contained in ALL_TABLES.

    Your mission is to create two views showing different subsets of the data in the RANK, STUDENT and TEACHER tables, so that they will look something like this:

    CREATE VIEW  public_info
    AS
    SELECT  ...
    FROM    comqdhb.grade     g
    JOIN    comqdhb.student   s  ON ...
    JOIN    comqdhb.teacher   t  ON ...
    WHERE   ...
    

Maybe you are looking for