Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Table Creation and Storage

$
0
0

I just downloaded SQL Server 2012 and am trying to create new databases with tables inside of them. However, the tables I create in my query don't get stored in my newly created database; they're stored in the System Databasemaster. Is there something I'm doing wrong here? 

CREATE DATABASE cis430_lab1;

CREATE TABLE EMPLOYEE (
	fname		varchar(100),
	minit		char(1),
	lname		varchar(100),
	ssn			char(9),
	bdate		date,
	addr		varchar(100),
	sex			char(1),
	salary		int,
	super_ssn	char(9),
	dno			int
);
CREATE TABLE DEPARTMENT (
	dname			varchar(100),
	dnumber			int,
	mgr_ssn			char(9),
	mgr_start_date	date
);

INSERT INTO EMPLOYEE VALUES('John', 'B', 'Smith', '123456789', '09-Jan-55', '731 Fondren, Houston, TX',
	'M', 30000, '987654321', 5); 
INSERT INTO EMPLOYEE VALUES('Franklin', 'T', 'Wong', '333445555', '08-Dec-45', '638, Voss, Houston, TX',
	'M', 40000, '888665555', 5); 
INSERT INTO EMPLOYEE VALUES('Joyce', 'A', 'English', '453453453', '31-Jul-62', '5631 Rice, Houston, TX',
	'F', 25000, '333445555', 5);
INSERT INTO EMPLOYEE VALUES('Ramesh', 'K', 'Narayen', '666884444', '15-Sep-52', '975 Fire Oak, Houston, TX',
	'M', 38000, '333445555', 5); 
INSERT INTO EMPLOYEE VALUES('James', 'E', 'Borg', '888665555', '10-Nov-27', '450 Stone, Houston, TX',
	'M', 55000, null, 1); 
INSERT INTO EMPLOYEE VALUES('Jennifer', 'S', 'Wallace', '987654321', '20-Jun-31', '291 Berry, Bellaire, TX',
	'F', 43000, '888665555', 4); 
INSERT INTO EMPLOYEE VALUES('Ahmad', 'V', 'Jabbar', '987987987', '29-Mar-59', '980 Dallas, Houston, TX',
	'M', 25000, '987654321', 4); 
INSERT INTO EMPLOYEE VALUES('Alicia', 'J', 'Zelaya', '999887777', '19-Jul-58', '3321 Castle, Spring, TX',
	'F', 25000, '987654321', 4);

INSERT INTO DEPARTMENT VALUES('Headquarters', 1, '888665555', '19-Jun-71');
INSERT INTO DEPARTMENT VALUES('Administration', 4, '987654321', '01-Jan-85');
INSERT INTO DEPARTMENT VALUES('Research', 5, '333445555', '22-May-78');
INSERT INTO DEPARTMENT VALUES('Automation', 7, '123456789', '06-Oct-05');

SELECT * FROM EMPLOYEE;
SELECT * FROM DEPARTMENT;


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>