New User Creation, table creation, addition, deletion, modification, and query (Oracle)

Source: Internet
Author: User

---------------------------------

--Create a new user

---------------------------------

Create user hahaya

Identified by hahaya

Default tablespace users

Temporary tablespace temp;

---------------------------------

--ToHahayaUser authorization

---------------------------------

Grant dba, sysdba to hahaya

With admin option;

---------------------------------

--Create a table

---------------------------------

Create table hahaya. book_book (

Book_id int not null,

Book_name varchar2 (200 ),

Book_price int,

Primary key (book_id)

);

-----------------------------------------------------

--Insert data to a table

--When using the second method, the value must be equal to the number of fields in the table.

------------------------------------------------------

Insert into hahaya. book_book (book_id, book_name, book_price) values (1, 'thinking in c ++ ', 80 );

Insert into hahaya. book_book values (2, The C ++ Programming Language, 100 );

-------------------------------------------------------

--Query table data

-------------------------------------------------------

Select * from hahaya. book_book;

 

-------------------------------------------------------

--Change the data of a row in a table

-------------------------------------------------------

Update hahaya. book_book set book_price = 90

Where book_id = 2;

Select * from hahaya. book_book;

 

-----------------------------------------------

--Delete a row of data in a table

-----------------------------------------------

Delete from hahaya. book_book where book_id = 2;

Select * from hahaya. book_book;

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.