<span style='</span></div><div align="center">بسم الله الرحمن الرحيم
Displaying Table Structure: In SQL*Plus, you can display the structure of a table using the DESCRIBE command. The result of the command is to see the column names, Datatypes, and whether a column must contain data. ********************* DESC[RIBE] tablename ******************** Where: tablename is the name of any existing table, view, or synonym accessible to the user. Example: Display information about the structure of the S_DEPT table. ##################### SQL> DESCRIBE s_dept ##################### NAME NULL? Type --------- --------- ------- ID NOT NULL NUMBER (7) NAME NOT NULL VARCHAR2 (25) REGION_ID NUMER (7) ########################### Where: Null? Indicates that a column must contain data. Type displays the datatype for a column. &&&&&&&&&&&&&&&&&&&&&&&& Datatype Description ======================================= NUMBER (p,s)```` Description *************************** VARCHAR2(s) Number value having a maximum number of digits p , and the number of digits to the right of the decimal point s . ********************************** DATE Variable length character value of maximum size s . ************************************* CHAR(s) Fixed length character value of size s. ================================ The Basic Query Block: A SELECT statement retrieves information from the database, implementing all algebraic operators . Syntax ¬+++++++++++++++++++++++ SELECT (DISTINCT) {* , column [alias] , …. } FROM table ; +++++++++++++++++++++++ Where : SELECT is a list of at least one column . DISTINCT suppresses duplicates . * select all columns . column selects the named column . alias gives selected columns a different heading FROM table specifies the table containing the columns. Selecting All Columns and Rows The asterisk (*) selects all columns from the table . Example List all columns and all rows from the S_DEPT table . &&&&&&&&&&&&&&&&&&&&&& SQL> SELECT * 2 FROM s_dept; ################################## ID NAME REGION_ID ---- --------- ------------------ 10 Finance 1 31 Sales 1 32 Sales 2 33 Sales 3 34 Sales 4 35 Sales 5 41 Operations 1 42 Operations 2 43 Operations 3 44 Operations 4 45 Operations 5 50 Administration 1 12 Rows selected . ################################################### Selecting Specific Columns: You restrict the query to display only certain columns by specifying the column names , separated by commas , in the SELECT clause . Example: Display all department numbers, employee last names, and manager numbers in the S_EMP table . ###################### SQL> SELECT dept_id, last_name, manager_id 2 FROM s_emp; ********************** DEPT_ID LAST_NAME MANAGER_ID ------------- ------------------- --------------------- 50 Velasquez 41 Ngao 1 31 Nagayama 1 10 Quick-to-see 1 50 Ropeburn 1 41 Urguhart 2 42 Menchu 2 43 Biri 2 44 Catchpole 2 … 25 rows selected ==========================================