solve:
Write a single SQL statement to create a new table named Login with five columns: User(Text), Password (Text), Update (Date), Status (Text) and CustomerID (Integer)
SQL Queries
1)
CREATE TABLE Login(
User TEXT,
Password TEXT,
Update DATE DEFAULT CURRENT_TIMESTAMP, // this will default to
current date and time
Status TEXT(255) CHECK (Status='active' OR Status='inactive'), //
this check constraint will check if status is active or inactive
and no other value
CustomerID INTEGER
);
2)
SELECT * FROM Track WHERE
LOWER(name)=LOWER('Hello');
if you like the answer please provide a thumbs up.
solve: Write a single SQL statement to create a new table named Login with five columns:...
Write a single SQL statement to create a new playlist called 'Background music'; and write another single SQL statement to associate the new playlist with the 10 longest duration tracks of jazz music from the Track table. CREATE TABLE MediaType ( MediaTypeID INTEGER PRIMARY KEY NOT NULL, Name TEXT ); CREATE TABLE Playlist ( PlaylistID INTEGER PRIMARY KEY NOT NULL, Name TEXT ); CREATE TABLE PlaylistTrack ( PlaylistID INTEGER NOT NULL, TrackID INTEGER NOT NULL, PRIMARY KEY (PlaylistID, TrackID), FOREIGN...
1. (10pt) Write SQL statement to insert a new record (66", "Python") for columns "CustomerID" and "CustomerName", into the Customers table?
SQL CHECK CONSTRAINT AND TEST CASE... SQL Query Here are the tables: CREATE TABLE Movies( movieID INT, name VARCHAR(30) NOT NULL, year INT, rating CHAR(1), length INT, totalEarned NUMERIC(7,2), PRIMARY KEY(movieID), UNIQUE(name, year) ); CREATE TABLE Showings( theaterID INT, showingDate DATE, startTime TIME, movieID INT, priceCode CHAR(1), PRIMARY KEY(theaterID, showingDate, startTime), FOREIGN KEY(theaterID) REFERENCES Theaters, FOREIGN KEY(movieID) REFERENCES Movies ); CREATE TABLE Tickets( theaterID INT, seatNum INT, showingDate DATE, startTime TIME, customerID INT, ticketPrice NUMERIC(4,2), PRIMARY KEY(theaterID, seatNum, showingDate, startTime)...
Write the SQL statement to create a five-field table to contain sample student information. The constraints that need to be satisfied by the attributes of this table are as follows: the attribute First_Name is mandatory and can have up to 16 characters, the attribute Last_Name is mandatory and can have up to 16 characters, the attribute Date_Of_Birth is of type date is required, the StarID field identifies each student and is 8 characters long the GPA field is numeric that...
1. Write an INSERT statement that adds this row to the Categories table: CategoryName: Brass Code the INSERT statement so SQL Server automatically generates the value for the CategoryID column. 2. Write an UPDATE statement that modifies the row you just added to the Categories table. This statement should change the Category Name column to “Woodwinds”, and it should use the CategoryID column to identify the row. 3.Write an INSERT statement that adds this row to the Products table: ProductID:...
(1) Use a single SQL statement to create a relational table and to load into the table all information about the orders submitted in 1996 or in 1998 by the customers located in Paris or in London or in Madrid. Next, enforce the appropriate consistency constraints on the new table. (2) Create a new relational table to store information about the company names of all suppliers and the total number of products supplied by each supplier. Enforce, the appropriate consistency...
2. Write a script that implements the following design: In the Downloads table, the user_id and product_id columns are the foreign keys. Create these tables in the ex schema. Create the sequences for the user_id, download_id, and product_id columns. Include a PL/SQL script to drop the table or sequence if it already exists. Include any indexes that you think are necessary. 3. Write a script that adds rows to the database that you created in exercise 2. Add two rows...
1. Write an Sql statement to display all the columns in the driver table Write an SQL statement to display the name, location, and certified for all drivers that have Certified equal to Y. Sort the results in descending order by driverid 3. Write an SQL statement to display the group the data by driverid so we can find the sum of hours and miles logged from timesheet 4. Write an update statement to set the certified to P for...
Create a single script (.m file) to complete this assignment. Unless directed otherwise, use meaningful variable names for each variable: do not use the default variable ans to store your results. For this assignment do not suppress your output with semi- colons (). Each problem (ie. Problem 1. Problem 2, and Problem 4) should be in a separate cell, using the cell mode feature of MATLAB; the subparts should all be contained in the same cell as the parent problem....
Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates to the following tables: • Employee table (project 1) create table Employee ( empNumber char(8) not null, firstName varchar(25) null, lastName varchar(25) null, ssn char(9) null, address varchar(50) null, state char(2) null, zip char(5) null, jobCode char(4) null, dateOfBirth date null, certification bit null, salary money null, constraint PK_EMP PRIMARY KEY(empNumber), constraint EMP_STATECHECK CHECK(state in ('CA','FL')) ) GO • Job table (project 1) create...