CREATE TABLE Bill(
bill_id char(15) PRIMARY KEY,
bill_name VARCHAR(150) NOT NULL,
dateOfVoteCommittee date,
dateOfVote date,
isPassed tinyint(1) CHECK (isPassed IN (0,1)),
date_signed date,
isVeto tinyint(1) CHECK (isVeto IN (0,1)),
dateOfVote_override date,
proposed_person_id INT,
committee_id INT,
foreign key(proposed_person_id) REFERENCES
Congressman(person_id),
foreign key(committee_id) REFERENCES Committee(committee_id)
);
INSERT INTO Bill (bill_id, bill_name, dateOfVote, isPassed, date_signed, isVeto, dateOfVote_override, proposed_person_id, commitee_id) VALUES(1,'SB2 Florida Statutes',DATE'2019-03-27',1,DATE'2019-03-27',0,23,);
*I am getting this error - mysql
Mysql doesn't like the date entries in the insert statement. Schema above for reference.
INSERT INTO Bill (bill_id, bill_name, date of vote, isPassed, date_signed, isVeto, dateOfVote_override, proposed_person_id, commitee_id) VALUES(1,'SB2 Florida Statutes',DATE'2019-03-27',1,DATE'2019-03-27',0,23,);
the underlined words above are creating errors. why you have written DATE before the actual date. you simply need to write actual data like ..... '2019-03-27'.
also, you have written an applied comma after last value inserted which is 23. the comma doesn't come at the end.
the correct statement is written below.
INSERT INTO Bill (bill_id, bill_name, date of vote, isPassed, date_signed, isVeto, dateOfVote_override, proposed_person_id, commitee_id) VALUES(1, 'SB2 Florida Statutes', '2019-03-27', 1, '2019-03-27', 0, 23);
CREATE TABLE Bill( bill_id char(15) PRIMARY KEY, bill_name VARCHAR(150) NOT NULL, dateOfVoteCommittee date, dateOfVote date, isPassed...
CREATE TABLE Gender ( gender CHAR(1), description VARCHAR(10), PRIMARY KEY (gender) ); CREATE TABLE People ( ID INT, name VARCHAR(50), gender CHAR(1), height FLOAT, PRIMARY KEY (ID), FOREIGN KEY (gender) REFERENCES Gender (gender) ); CREATE TABLE Sports ( ID INT, name VARCHAR(50), record FLOAT, PRIMARY KEY (ID), UNIQUE (name) ); CREATE TABLE Competitions ( ID INT, place VARCHAR(50), held DATE, PRIMARY KEY (ID) ); CREATE TABLE Results ( peopleID INT NOT NULL, competitionID INT NOT NULL, sportID INT NOT NULL,...
create table candidate ( cand_id varchar(12) primary key, -- cand_id name varchar(40) -- cand_nm ); create table contributor ( contbr_id integer primary key, name varchar(40), -- contbr_nm city varchar(40), -- contbr_city state varchar(40), -- contbr_st zip varchar(20), -- contbr_zip employer varchar(60), -- contbr_employer occupation varchar(40) -- contbr_occupation ); create table contribution ( contb_id integer primary key, cand_id varchar(12), --...
CREATE TABLE person ( pid INTEGER NOT NULL ,pname VARCHAR(30) NOT NULL ,PRIMARY KEY (pid) ); CREATE TABLE organization ( oid INTEGER NOT NULL ,oname VARCHAR(30) NOT NULL ,PRIMARY KEY (oid) ); CREATE TABLE venue ( vid INTEGER NOT NULL ,area CHAR(1) NOT NULL ,capacity INTEGER NOT NULL ,PRIMARY KEY (vid) ); CREATE TABLE calendar ( vid INTEGER NOT NULL ,date DATE NOT NULL ,price NUMERIC(6,2) NOT NULL ,PRIMARY KEY(vid,date) ,FOREIGN KEY(vid) REFERENCES venue(vid) ); CREATE TABLE event ( eid...
CREATE TABLE DEPT (
DEPTNO INTEGER NOT NULL,
DNAME VARCHAR(14),
LOC VARCHAR(13),
PRIMARY KEY (DEPTNO));
INSERT INTO DEPT VALUES (10,'SPORTS','NEW YORK');
INSERT INTO DEPT VALUES (20,'HOME','DALLAS');
INSERT INTO DEPT VALUES (30,'OUTDOOR','CHICAGO');
INSERT INTO DEPT VALUES (40,'CLOTHING','BOSTON');
CREATE TABLE EMP (
EMPNO INTEGER NOT NULL,
ENAME VARCHAR(10),
JOB VARCHAR(9),
MGR INTEGER,
SAL FLOAT,
COMM FLOAT,
DEPTNO INTEGER NOT NULL,
FOREIGN KEY (DEPTNO) REFERENCES DEPT (DEPTNO),
FOREIGN KEY (MGR) REFERENCES EMP(EMPNO),
PRIMARY KEY (EMPNO));
INSERT INTO EMP VALUES (7839,'KING','PRESIDENT',NULL,
5000,NULL,10);
INSERT INTO...
CREATE TABLE Users ( userId varchar (30) NOT NULL, pass varchar (30), fname varchar (50), lname varchar (50), email varchar (50), gender char(1), age integer, banned boolean, PRIMARY KEY (userId), UNIQUE(email)) CREATE TABLE FavSellers ( userId varchar (30), sellerId varchar (30), PRIMARY KEY (userId, sellerId), FOREIGN KEY(userId) references Users, FOREIGN KEY(sellerId) references Users(userId)) CREATE TABLE Items ( itemId integer, title varchar (50), ...
Relation Students has schema: CREATE TABLE Students ( BannerID CHAR(9), stuName VARCHAR(40) NOT NULL, scholarship INT, PRIMARY KEY(BannerID)); The relation Students is currently empty. Develop a test that determines whether an insertion into Students is currently legal. Then apply your test to determine which of the following INSERT statements is allowable. a. INSERT INTO Students VALUES(950111333, ’John Smith’, 1000); b. INSERT INTO Students (BannerID, stuName) VALUES(‘950111333’, ’John Smith’); c. INSERT INTO Students VALUES(‘950111222’, NOT NULL,...
-- Schema definition
create table Customer (
cid smallint not null,
name varchar(20),
city varchar(15),
constraint customer_pk
primary key (cid)
);
create table Club (
club varchar(15) not null,
desc varchar(50),
constraint club_pk
primary key
(club)
);
create table Member (
club varchar(15) not null,
cid
smallint not null,
constraint member_pk
primary key (club,
cid),
constraint mem_fk_club
foreign key (club)
references Club,
constraint mem_fk_cust...
CREATE TABLE GLAccounts ( AccountNo INT, AccountDescription VARCHAR(50), -- CONSTRAINT GLAccounts_PK PRIMARY KEY(AccountNo), -- CONSTRAINT AccountDescription_NULL CHECK(AccountDescription IS NOT NULL), -- CONSTRAINT AccountDescription_Zero_LEN CHECK(LEN(AccountDescription)>0) ); GO ----------------------------------------------------------------------------- CREATE TABLE Terms ( TermsID INT, TermsDescription VARCHAR(50), TermsDueDays SMALLINT, -- CONSTRAINT PK_Terms PRIMARY KEY(TermsID), -- CONSTRAINT TermsDescription_NULL CHECK(TermsDescription IS NOT NULL), CONSTRAINT TermsDueDays_NULL CHECK(TermsDueDays IS NOT NULL), -- CONSTRAINT TermsDescription_zero_LEN ...
SQL
I have a database
CREATE TABLE vendor
( vid CHAR(2) NOT NULL,
vname VARCHAR(25) NOT NULL,
PRIMARY KEY (vid) );
CREATE TABLE category
( catid CHAR(2) NOT NULL,
catname VARCHAR(25) NOT NULL,
PRIMARY KEY (catid) );
CREATE TABLE product
( pid CHAR(3) NOT NULL,
pname VARCHAR(25) NOT NULL,
price NUMERIC (7,2) NOT NULL,
vid CHAR(2) NOT NULL,
categoryid CHAR(2) NOT NULL,
PRIMARY KEY (pid));
CREATE TABLE region
( rid CHAR NOT NULL,
rname VARCHAR(25) NOT NULL,
PRIMARY KEY (rid)...
MICROSOFT SQL SERVER - Create the following views 1.List the employee assigned to the most projects 2.List the project with the most hours SCRIPT TO BUILD DATABASE create table department ( dept_ID int not null , dept_name char(50) NOT NULL, manager_ID int not null, manager_start_date date not null, constraint Dept_PK primary key (dept_ID), constraint D_Name_AK unique (dept_name) ); insert into department values(1,'abc',1,'2019-01-08'); insert into department values(2,'abc2',2,'2019-01-08'); insert into department values(3,'abc3',2,'2019-01-08'); insert into department values(4,'abc4',2,'2019-01-08'); /*project table done*/ create table project...