Kreiranje MS SQL testne bazice i security nad bazama

Opšte stavke :
You can do only three things with any database object, other than actually use it; you can create it, alter it, or drop it to get rid of it.
Unless permissions are explicitly assigned, only members of the following roles can execute these statements :
sysadmin
dbcreator
db_ddladmin
db_owner
Database roles (also referred to as database-level roles) are security roles that exist on a database level, as opposed to the server level. There are two kinds of database roles in SQL Server : fixed roles and flexible roles.
Fixed roles automatically exist in each database. Adding a user to one of these roles will not change that user’s permissions in any other database.
Fixed roles that are available in SQL Server :
db_owner – users in the db_owner role have it all, within a single database.
db_securityadmin – users can modify role permissions and manage permissions.
db_accessadmin – users have the ability to change database access.
db_backupoperator
db_ddladmin
db_datawriter
db_datareader
db_denydatawriter
db_denydatareader
Public – By default, the VIEW ANY DATABASE permission is granted to the public role.
You should never use the SA (system administrator) account for connecting from a web application.
Fixed roles automatically exist in each database. Adding a user to one of these roles will not change that user’s permissions in any other database.

Kako se vide svi korisnici nad nekom bazom (kod mene nema dodatnih, sve je default) :

Link vezan za bezbednost.

1. Kreirati bazu – desni klik na stavku “Databases”/New Database, pa popuniti stavke (ime baze, gde će da budu fajlovi baze i logovi baze, kako će se isti zvati, kako će im biti dozvoljno da radu, itd)
2. Kreirati tabelu (namestiti se na testnu bazu) :
create table spisak (
rednibroj int,
ime text,
prezime text,
sprat integer,
kancelarija integer
);
Ovime se dobija nova (prazna) tabela :

3. Ubaciti podatke u napravljenu tabelu (radi se kao “New Query”) :
insert into spisak (rednibroj, ime, prezime, sprat, kancelarija)
values (‘1’, ‘Vesna’, ‘Petrovic’, ‘1’, ‘110’);
Gde je “spisak” ime tavele, a (rednibroj, ime, prezime, sprat, kancelarija) su nazivi kolona u tabeli.
4. Kako pregledati sadržaj unesen u tabelu :
use veldatest;
select * from spisak;
U prvom redu naglašavamo koju bazu koristimo za upit.

Odličan tutorial za SQL komande (sa primerima).