Oracle notes: Basic SQL statements

Source: Internet
Author: User

Continue with the previously installed Oracle11g R2 (see). Here we use putty to log on to the linux system. The advantage of putty is that it can be copied and pasted on linux and windows at will, it is also very convenient to copy files to each other! You must use an oracle user to log on to oracle!

After the system successfully logs on to the database, use the username system provided by oracle to log on to the database, as shown in:

650) this. width = 650; "height = 363>

The following table tableA is used as an example.

1. Create a table

Create table Name (field name A character type, field name B character type );

Create table tableA (id integer, name varchar (25), age number );

2. delete a table

Drop table name;

Drop table tableA;

650) this. width = 650; "height = 362>

3. Add record

Insert into table name values ('record A', 'record B ', 'record C ');

Or insert into Table Name (field name A, field name C) values ('record A', 'record C ');

Insert into tableA values ('20170101', 'jack', '25 ');

Or insert into tableA (id, name, age) values ('20140901', 'jack', '25 ');

650) this. width = 650; "height = 168>

4. Add Fields

Alter table name ADD field name character type;

Alter table tableA add native varchar (20 );

650) this. width = 650; "height = 184>

5. Delete Fields

Alter table Name drop column field name;

Alter table tableA drop column native;

650) this. width = 650; "height = 187>

6. Modify records

Update table name set field name A = 'record C' where field name B = 'record B ';

Update tableA set age = '23' where name = 'jack ';

650) this. width = 650; "height = 263>

7. delete records

Delete from table name where field name A = 'record ';

Delete from tableA where name = 'jack'

650) this. width = 650; "height = 279>

8. query records

Select field name from table name where field name = 'record ';

Select name from tableA where age = '24 ';

650) this. width = 650; "height = 129>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.