NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

-- DDL KOMUTLARI
-- ALTER VE DROP SADECE CREATE İLE OLUŞTURULMUŞ NESNELER ÜZERRİNDE İŞLEMLER YAPABİLİRLER...
-- CREATE VERİ TABANI NESNELERİ OLUŞTURMAYA YARAR...

--DB , TABLE , VİEW , STORED , PROCEDURE , TRİGGER

--VARSAYILAN AYARLARLA DATABASE (DB) OLUŞTURMA

CREATE DATABASE Hastane


-- detaylı database oluşturma
create database Hastane
on
(
name='hastane',
filename = 'C:Program FilesMicrosoft SQL ServerMSSQL12.MSSQLSERVERMSSQLDATAhastane.mdf',
size = 20, -- mb cinsinden
filegrowth = 5 -- mb cinsinden
)

log
on
(
name = 'hastane_log',
filename = 'C:Program FilesMicrosoft SQL ServerMSSQL12.MSSQLSERVERMSSQLDATAhastane.ldf',
size =20, -- mb cinsinden
filegrowth =5 -- mb cinsinden
)

use Hastane
-- tablo oluşturma

create table Poliklinik3
(
id int primary key identity,
p_adi nvarchar(50),
personel nvarchar (50),
hastaGiris date
)


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

-- OTEL VERİTABANI OLUŞTURMA


-- KODLARLA VERİTABANI OLUŞTURMA BU YAPIYLA OLUŞTURURUZ UZANTISI MDF DİR
create database otel
on
(
name = 'otel',
filename = 'C:Program FilesMicrosoft SQL ServerMSSQL12.MSSQLSERVERMSSQLDATAotel.mdf',
size = 20 ,
filegrowth = 5
)
log
-- VERİTABANINDA İŞLEM DOSYASI OLUŞTURUR DATABASE NAMESİYLE LOG NAMESİ AYNI OLAMAZ...
--SİZE
on
(
name = 'hastane_log',
filename = 'C:Program FilesMicrosoft SQL ServerMSSQL12.MSSQLSERVERMSSQLDATAotel.ldf',
size =20, -- mb cinsinden
filegrowth =5 -- mb cinsinden
)


--OTEL VERİTABANININ TABLOLARINI OLUŞTURMA

create table Hizmetler
(
hizmetno int primary key identity ,
hizmetadı nvarchar (50),
hizmetucreti money
)

create table servisler
(
servisno int primary key identity ,
servis nvarchar (50),
servisücreti money
)
create table menü
(
menuno int primary key identity ,
menüadı nvarchar (50),
)

create table lokanta
(
tuketilenno int primary key identity ,
tüketilen nvarchar (50),
ucreti money
)

create table odalar
(
odano int primary key identity ,
odafiyat money,
yataksayısı tinyint,
odaturu nvarchar (50),
personelNo int
)

create table personel
(
personelno int primary key identity,
adı nvarchar (50),
soyadı nvarchar(50),
dogumtarihi date,
cinsiyet nchar,
isebaslama date,
istencikis date ,
telefon nchar,
eposta nvarchar,
kangrubu char,
maas money
)
create table musterikayıt
(
musterino int primary key identity,
adi nvarchar(50),
soyadi nvarchar(50),
cinsiyet nvarchar(50),
telefon nchar,
eposta nvarchar (50),
kangrubu int
)
create table musterihesap
(
islemno int primary key identity,
musterino int,
hizmetno int,
servisno int,
tüketilenno int,
sonhesap money,
giristarihi date,
cikistarihi date ,
kisisayisi int,
odano int
)

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

-- ALTER
-- create ile oluşturulan veritabanı nesnelerinde değişiklik yapmaya yarar...



USE cinema
-- cinemanın mbtı 25 olarak değiştirdik...
ALTER DATABASE cinema
-- dosyada değişikliik yap anlamında
modify file
(
name ='cinema',
size =25
)
-----------------------------------------------------------
select * from sys.tables
select * from fimler

alter table fimler
add imdbpuani float


alter table fimler
alter column imdbpuani int

select * from bizimSinifinOyunculari

alter table bizimSinifinOyunculari
drop column soyadi


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

-- SP RENAME

SP_RENAME 'FİMLER', 'FİLMLER'
SELECT * FROM FİLMLER

-- column yazarsak kolon adını değiştirir yazmazsak tablo ismini değiştirir...
SP_RENAME 'cinema','Sinema','database'
SELECT * FROM FİLMLER

sp_rename 'Fimler','Filmler'




--------------------------------------------------------------------------
-- DROP TABLE

-- (CREATE İLE OLUŞTURULMUŞ NESNELERİ SİLMEYE YARAR)

DROP TABLE bizimSinifinOyunculari

drop database Hastane

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

--CONSTRAİNT

--1. DEFAULT CONTRAİNT (VARSAYILAN)
--2. CHECK CONSTRAİNT
--3. PRİMARY KEY CONSTRAİNT
--4. UNİQUE CONSTRAİNT
--5. FOREİNG KEY CONSTRAİNT

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.