文件名称:选出特定的列-SQL语言基础
文件大小:5.26MB
文件格式:PPT
更新时间:2024-05-15 13:24:45
SQL 基础
选出特定的列 * DEPTNO LOC --------- ------------- 10 NEW YORK 20 DALLAS 30 CHICAGO 40 BOSTON SQL> SELECT deptno, loc 2 FROM dept; * 注意观察:发现数字都是右对齐的,字符是左对齐,缺省状态。 Selecting Specific Columns, All Rows You can use the SELECT statement to display specific columns of the table by specifying the column names, separated by commas. The example on the slide displays all the department numbers and locations from the DEPT table. In the SELECT clause, specify the columns that you want to see, in the order in which you want them to appear in the output. For example, to display location before department number, you use the following statement: Instructor Note You can also select from pseudocolumns. A pseudocolumn behaves like a table column but is not actually stored in the table. You cannot insert or delete values of the pseudocolumns. The available pseudocolumns are CURRVAL, NEXTVAL, LEVEL, ROWID, and ROWNUM. SQL> SELECT loc, deptno 2 FROM dept; LOC DEPTNO ------------- --------- NEW YORK 10 DALLAS 20 CHICAGO 30 BOSTON 40