Oracle database study notes (day2)

1. Role VS Permission
  Role: a set of permissions (connect, resource, dba)
  A statement that can only do one specific thing, called a specific
  permission. Give a specific permission to the user
  GRANT [SELECT|UPDATE|DELETE| INSERT] ON [table name] TO [user name];
  if the user who grants the permission is allowed to grant the permission to other users, you need to set WITH GRANT OPTION;
  GRANT [SELECT|UPDATE|DELETE|INSERT] ON [table name] TO [ User name] WITH GRANT OPTION;
  revoke permission:
  REVOKE [authority name] FROM [user name];
  REVOKE [authority name] ON [table name] FROM [user name];
  If the user's permission is revoked, he will grant other users Permissions are also withdrawn
  at the same time//(I tried this sentence, it is not correct) If you do not want the user to continue to have the permissions granted to other users, you can re-authorize the user (without with grant option)

2.SQL structured query Language (keyword)
  Structured query language: According to the SQL statement, the structured data is displayed in the session console.
  Projection (projection) principle: control data column operation

  . Data is case-sensitive
  : use uppercase letters for keywords, and lowercase letters for table names, user names, etc.

select × from emp where ename='smith';
SELECT × FROM emp WHERE ename='SMITH';

  The query results of the above two sentences are different because 'smith' and 'SMITH' are different

  1> Simple query ('string' |123)
SELECT [DISTINCT] *|[column name 1 | string 1] [as alias 1], [column name 2 | string 2] [as alias 2]...
FROM table name [table alias]
    string output Use "||" to connect

  2> Qualified query and sorting display
SELECT [DISTINCT] *|[column name 1|string 1] [as alias 1],[column name 2|string 2] [as alias 2]… …
FROM table name [table alias]
WHERE condition (qualified operator>|<|=|!=|<>|BETWEEN start bit AND end bit (interval)|IN|IS|IS NULL|LIKE _%)
and or not (and or not)
ORDER BY [sort field 1|column index number] [ASC|DESC],[sort field 2] [ASC|DESC] (default ascending ASC sort)

  3>Single line function——①Character function
() UPPER(string|columnname)
()LOWER(string|columnname)
()INITCAP(string|columnname)
()REPLACE(string|columnname,'replaced string', 'substitute string')
()LENGTH(string|column name)
()SUBSTR(string|column name, start bit[, stop bit])
()TRIM(LTRIM|RTRIM)(string|column name)
()LPAD|RPAD( string | column name, total length, padded string | column name)

















































Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325732518&siteId=291194637