1. pollibangla2015@gmail.com : admin :
code - Polli Bangla

code

vscode sql:

create table students(

    roll number (4) not null ,

    name varchar (20),

    primary key (roll)

);

insert into students( roll , name)

values (121, ‘Maruf’);

insert into students (roll , name)

values (122, ‘Kanu’);

create table courses(

    c_id varchar (10) not null,

    c_name varchar (30),

    year number (1),

    term number (1),

    primary key (c_id)

);

insert into courses( c_id, c_name, year, term)

values (‘123’, ‘Bangla’ , 1 , 2);

insert into courses (c_id , c_name, year , term)

values (‘124’, ‘English’ , 2, 4);

run sql code :

SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 23 02:35:33 2023

Copyright (c) 1982, 2014, Oracle. All rights reserved.

SQL> connect system
Enter password:
Connected.
SQL> create user Mobile identified by 1234;

User created.

SQL> grant all privileges to Mobile;

Grant succeeded.

SQL> @C:\Users\creat\Desktop\DBS\new.sql;
create table students(
*
ERROR at line 1:
ORA-00955: name is already used by an existing object

1 row created.

1 row created.

create table courses(
*
ERROR at line 1:
ORA-00955: name is already used by an existing object

insert into courses( c_id, c_name, year, term)
*
ERROR at line 1:
ORA-00904: “C_ID”: invalid identifier

insert into courses (c_id , c_name, year , term)
*
ERROR at line 1:
ORA-00904: “C_ID”: invalid identifier

SQL> select * from students;

  ROLL NAME                 PHONE

  3008 Maruf
  3058 Kanij
  3012 Maruf
   121 Maruf
   122 Kanu

SQL> select from courses;
select from courses
*
ERROR at line 1:
ORA-00936: missing expression

SQL> select * from courses;

C_NO C_NAME YEAR TERM


101 c 2 6
202 c++ 1 3

SQL> describe students;
Name Null? Type


ROLL NOT NULL NUMBER(7)
NAME VARCHAR2(20)
PHONE VARCHAR2(15)

SQL> describe courses;
Name Null? Type


C_NO NOT NULL VARCHAR2(10)
C_NAME VARCHAR2(30)
YEAR NUMBER(1)
TERM NUMBER(1)

SQL> alter table students
2 add phone varchar(15);
add phone varchar(15)
*
ERROR at line 2:
ORA-01430: column being added already exists in table

SQL> describe students;
Name Null? Type


ROLL NOT NULL NUMBER(7)
NAME VARCHAR2(20)
PHONE VARCHAR2(15)

SQL> alter table students
2 modify roll number (7);

Table altered.

SQL> alter table courses
2 rename column c_id to c_no;
alter table courses
*
ERROR at line 1:
ORA-00957: duplicate column name

SQL> describe students;
Name Null? Type


ROLL NOT NULL NUMBER(7)
NAME VARCHAR2(20)
PHONE VARCHAR2(15)

SQL> describe courses;
Name Null? Type


C_NO NOT NULL VARCHAR2(10)
C_NAME VARCHAR2(30)
YEAR NUMBER(1)
TERM NUMBER(1)

SQL> insert into students(roll, name, number)
2 values(3092, ‘Hridoy’ , 154656410);
insert into students(roll, name, number)
*
ERROR at line 1:
ORA-01747: invalid user.table.column, table.column, or column specification

SQL> insert into students (roll, name, number)
2 values (3013, ‘Tuhin’ , 166465666);
insert into students (roll, name, number)
*
ERROR at line 1:
ORA-01747: invalid user.table.column, table.column, or column specification

SQL> insert into courses (c_no, c_name, year, term)
2 values (454, ‘Itihas’, 4, 8);

1 row created.

SQL> insert into courses (c_no, c_name, year, term)
2 values(74, ‘Patihas’ , 3, 4);

1 row created.

SQL> select * from students;

  ROLL NAME                 PHONE

  3008 Maruf
  3058 Kanij
  3012 Maruf
   121 Maruf
   122 Kanu

SQL> select * from courses;

C_NO C_NAME YEAR TERM


101 c 2 6
202 c++ 1 3
454 Itihas 4 8
74 Patihas 3 4

SQL>

Reset system password :

SQL> conn/ as sysdba
Connected.
SQL> alter user system identified by password;

© 2023 Polli Bangla
Powered by: Polli Bangla IT Team

এই লেখাটি কপি করতে পারবেন না।