Question

6. [5] Create the following table: CREATE TABLE customer ( cust_name VARCHAR(30) NOT NULL, address VARCHAR(60), UNIQUE (cust

Database Management

0 0
Add a comment Improve this question Transcribed image text
Answer #1

6) We will get the output for both the insert commands because Mysql considers NULL values as distinct values.

  • So put not null constraint for address column and then it will shows an error if we enter duplicate values
  • Mysql checks the uniqueness by combining the values in two columns...if the values in two columms are same then it will return error showing duplicate entry

5 6 7 8 9 10 11 12 13 14 create table customer cust_name varchar(30) NOT NULL, address varchar(60)NOT NULL, unique (cust_name

7) By using Check constarint we ensure that all employees have minimum wage 10

1. ll Result $sqlite3 database. sdb <main.sql 3 Error: near line 7: CHECK constraint failed: employee Execute > Share main.sq

​​​​​​​8) when we enter the account_number in customer table it will check the constraint whether that account_number exists in account table or not

Add a comment
Know the answer?
Add Answer to:
Database Management 6. [5] Create the following table: CREATE TABLE customer ( cust_name VARCHAR(30) NOT NULL,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • -- Schema definition create table Customer (     cid   smallint not null,     name varchar(20),    ...

    -- 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...

  • SQL I have a database CREATE TABLE vendor ( vid CHAR(2) NOT NULL, vname VARCHAR(25) NOT...

    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)...

  • please answer 56789 CREATE TABLE ALLDRINKS(   /* All legal drinks */ DRINK       VARCHAR(30)   NOT NULL,  ...

    please answer 56789 CREATE TABLE ALLDRINKS(   /* All legal drinks */ DRINK       VARCHAR(30)   NOT NULL,   /* Drink name   */    CONSTRAINT DRINKNAME_PKEY PRIMARY KEY(DRINK) ); CREATE TABLE DRINKERS ( /* All drinkers */ DRINKER   VARCHAR(30)   NOT NULL,    CONSTRAINT DRINKERS_PKEY PRIMARY KEY (DRINKER)); CREATE TABLE LOCATED(   /* Pubs have locations */ PUB           VARCHAR(30)   NOT NULL,   /* Pub name   */ STREET       VARCHAR(30)   NOT NULL,   /* Street name   */ BLDG_NO       DECIMAL(4)   NOT NULL,   /* Building number   */...

  • Given: Create table Book ( Book_id integer, Book_title varchar(50), Author varchar(50), Publish_date date, Type varchar(30), Edition...

    Given: Create table Book ( Book_id integer, Book_title varchar(50), Author varchar(50), Publish_date date, Type varchar(30), Edition number, Quantity number, Primary key (Book_id) ); insert into Book values (1,'The Old Man and the Sea','Hemingway' ,date '1978-1-1','hardcopy',3,2); insert into Book values (2,'The Old Man and the Sea','Hemingway' ,date '1979-1-1','hardcopy',4,1); insert into Book values (3,'The Old Man and the Sea','Hemingway' ,date '1980-1-1', 'hardcopy',5,10); insert into Book values (4,'A Farewell to Arms','Hemingway' ,date '1986-1-1','hardcopy',2,18); insert into Book values (5,'For Whom the Bell Tolls','Hemingway' ,date...

  • CREATE TABLE DEPT ( DEPTNO INTEGER NOT NULL, DNAME VARCHAR(14), LOC VARCHAR(13), PRIMARY KEY (DEPTNO)); INSERT...

    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...

  • SQL Command - Create a view called S LIST that lists the Cardholder Number, last name,...

    SQL Command - Create a view called S LIST that lists the Cardholder Number, last name, first name and due date for all cardholders who have not returned a book. Use the CREATE OR REPLACE VIEW AS ... command. TABLE CARD HOLDERS Cardholder Numberint NOT NULL CONSTRAINT CH PK PRIMARY KEY, First_Name varchar(10) NULL, LastName varchar(15) NULL, Address varchar(20) NULL, varchar(15) NULL, State char(2) NULL, Zip_Code char(5) NULL) City TABLE BOOKS CHECKED OUT Cardholder_Numberint NOT NULL, Book Numberint NOT NULL,...

  • create table candidate ( cand_id   varchar(12) primary key,   -- cand_id name       varchar(40)           --...

    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),           --...

  • I need help with the following SQL query for a company database (script given below). The...

    I need help with the following SQL query for a company database (script given below). The name of the Department. The number of employees working in that department. The number of different projects controlled by this department. The name of the project controlled by this department that has the maximum number of employees of the company working on it. The number of the above project. The cumulative sum of the number of employees of the company working on the projects...

  • Help In Database: Next comes the data entry: Make up data for your database, or find...

    Help In Database: Next comes the data entry: Make up data for your database, or find real data. You can enter the data with INSERT statements, but it is much easier to use PhpAdmin. It has a form where you can type the data directly. Alternatively, you can use PhpAdmin to import CSV data (comma-separated values), which you can export from Excel. Include at least 3 rows in each of the entity relations, and as many rows as you need...

  • Relation Students has schema: CREATE TABLE Students (     BannerID CHAR(9),     stuName VARCHAR(40) NOT NULL,...

    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,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT