Do the following steps:
- Create a user named the first name student and grant him full permission dba.
- Create a table in the first user named person It contains the following columns
- PersonID number(10) primary key
- FirstName varchar(50) not null
- LastName varchar(50)
- City varchar(50)
- Address varchar(50)
- Add a new column named FatherName varchar(50).
- Create a role named view it contains full permission dba.
- Create another user called the second name student and grant him role view.
- Create a table in the first user named company It contains the following columns
- companyName varchar(50)
- City varchar(50)
- Address varchar(50)
Expert Answer
- Comment
create user first_user for login MyLogin
To grant permission to a user using T-SQL, you first select the database using the use statement. You then assign the permission to the user using the grant statement. Here is the syntax-
use <database-name> grant <permission-name> on <object-name> to <username\principle>
An example for it would be-
USE EDU_TSQL GO Grant select on Course to Student.
You can then use following syntax for creating the table
CREATE TABLE Student(
PersonID int,
LastName varchar(50),
FirstName varchar(50),
Address varchar(50),
City varchar(50)
);Adding Father Name into the existing table
ALTER TABLE Student
ADD FatherName varchar(50)
ليست هناك تعليقات:
إرسال تعليق