Create a table tHW2_1_xxxx with the following fields and their data types (id:int, auto increment, Name: varchar(10), birthday: date, annual_salary: float, bno: varchar(8)), where id is primary key and bno is a foreign key to the branchno column of Branch table in the dreamhome database. All fields cannot be null. then insert five records into your tHW2_1_xxxx table. All the name, birthday, should be different.
Answer)
create table tHW2_1_xxxx (id int AUTOINCREMENT not null,
Name varchar(10) not null, birthday date not null, annual_salary
float not null, bno varchar(8)) not null, FOREIGN KEY (bno)
REFERENCES Branch(branchno));
INSERT INTO tHW2_1_xxxx (Name, birthday, annual_salary,
bno)
VALUES ( 'Paul', '2008-11-11', 20000, 1);
INSERT INTO tHW2_1_xxxx (Name, birthday, annual_salary,
bno)
VALUES ( 'John', '2001-10-12', 40000, 2);
INSERT INTO tHW2_1_xxxx (Name, birthday, annual_salary,
bno)
VALUES ( 'Siya', '1989-09-13', 60000, 3);
INSERT INTO tHW2_1_xxxx (Name, birthday, annual_salary,
bno)
VALUES ( 'Hero', '1995-08-14', 80000, 1);
INSERT INTO tHW2_1_xxxx (Name, birthday, annual_salary,
bno)
VALUES ( 'Iker', '1991-07-15', 40000, 12);
Create a table tHW2_1_xxxx with the following fields and their data types (id:int, auto increment, Name:...
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 a table with the following columns, named bsg_spaceship -- -- id - an auto-incrementing integer which is also the primary key -- name - variable-length string with a max of 255 characters, cannot be null -- separate_saucer_section - a boolean property which specifies whether or not there is a separate saucer section on the spaceship. This defaults to No. -- length - integer, cannot be null -- -- Once you have created the table, run the query "DESCRIBE...
-- 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...
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...
Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accounting, and employee data, and these different data sets must all be efficiently managed in order to make the data accessible. Companies rely on database engineers to ensure that their records are accurate, updated, and tracked in real time. This course covers structured query language (SQL) and how it can be used to manage database schemas, manipulate data, and analyze data. For your final...
Database Management
6. [5] Create the following table: CREATE TABLE customer ( cust_name VARCHAR(30) NOT NULL, address VARCHAR(60), UNIQUE (cust name, address)); A. Run the following inserts and explain why both work and how will you prevent it INSERT INTO customer VALUES ('Alex Doe', NULL); INSERT INTO customer VALUES ('Alex Doe', NULL); 7. [5] Modify the following table definition to ensure that all employees have a minimum wage of $10 CREATE TABLE employee ( empId INT PRIMARY KEY, empName VARCHAR(40)...
Given the bsg_planets table created by using the following definition query : -- CREATE TABLE `bsg_planets` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `population` bigint(20) DEFAULT NULL, `language` varchar(255) DEFAULT NULL, `capital` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 Insert information about the planet Mars which has a population of 2, language as "Binary" and "Olympus Mons" as Capital, in bsg_planets. Then list the row(s), with all the information for that...
Create a new database and execute the code below in SQL Server’s query window to create the database tables. CREATE TABLE PhysicianSpecialties (SpecialtyID integer, SpecialtyName varchar(50), CONSTRAINT PK_PhysicianSpecialties PRIMARY KEY (SpecialtyID)) go CREATE TABLE ZipCodes (ZipCode varchar(10), City varchar(50), State varchar(2), CONSTRAINT PK_ZipCodes PRIMARY KEY (ZipCode)) go CREATE TABLE PhysicianPractices (PracticeID integer, PracticeName varchar(50), Address_Line1 varchar(50), Address_Line2 varchar(50), ZipCode varchar(10), Phone varchar(14), Fax varchar(14), WebsiteURL varchar(50), CONSTRAINT PK_PhysicianPractices PRIMARY KEY (PracticeID), CONSTRAINT FK_PhysicianPractices_ZipCodes FOREIGN KEY (ZipCode) REFERENCES Zipcodes) go CREATE...
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), --...
a database of employees that corresponds to the
employee-payroll hierarchy is provided (see employees.sql to create
the employees for a MySQL database). Write an application that
allows the user to:
Add employees to the employee table.
Add payroll information to the appropriate table for each new
employee. For example, for a salaried employee add the payroll
information to the salariedEmployees table
1 is the entity-relationship diagram for the
employees database
Figure 1: Table relationships in the employees database [1].
Add...