Home > Database > Oracle > body text

How to read database in oracle

下次还敢
Release: 2024-04-02 11:24:17
Original
936 people have browsed it

How to run queries in Oracle database? Open a command prompt and connect to the database. Enter the command select * from table_name, where table_name is the name of the table to be queried.

How to read database in oracle

How to read Oracle database

Open command prompt

  1. In Windows, press Windows key R, type "cmd" and press Enter.
  2. In macOS, open the Terminal application.
  3. In Linux, open a terminal window.

Connect to the database

  1. Enter the following command:
<code>sqlplus username/password\@servername:port/servicename</code>
Copy after login
  • username:Your database username.
  • password: Your database password.
  • servername: The name or IP address of the database server.
  • port:Port number of the database (default port is 1521).
  • servicename: Database service name.

Example:

<code>sqlplus scott/tiger@localhost:1521/xe</code>
Copy after login

Run the query

After connecting to the database, you can run queries to retrieve data .

  1. Enter the following command:
<code>select * from table_name;</code>
Copy after login
  • table_name: The name of the table to be queried.

Example:

<code>select * from emp;</code>
Copy after login

Other useful commands

  • desc Table name: Display the structure of the table.
  • insert into table name (field name 1, field name 2, ...) values ​​(value 1, value 2, ...): Insert a new record.
  • update table name set field name 1 = value 1, field name 2 = value 2, ... where condition; : Update record.
  • delete from table name where condition: Delete records.

The above is the detailed content of How to read database in oracle. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template