Question

In: Computer Science

Create a ‘Student’ table using SQL query. The table must have at least five attributes from...

Create a ‘Student’ table using SQL query. The table must have at least five attributes from your choice with different data types.

Solutions

Expert Solution

Answer:

We have to create a database in order to create table in MySQL.

Create database using following command in MySQL

                                  create database databasename; ( Syntax )

                               for example: create database Student;

                             

And use the created database using following command.

                             > use databasename; ( Syntax)

                             > use Student;

                            

Create a table Student using following command.

                  > create table Student(Student_ID VARCHAR(20), Student_Name CHAR(20), Student_DOB DATE, Student_Age INT, CGPA FLOAT(10,2));

Insert values to the Student table using following command;

> insert into Student values(Student_ID, Student_Name, Student_DOB, Student_Age, CGPA);

Retrieve the Student table details using following command.

                         > select *from Student;

Finally i have created a table Student table using five different attributes with different datatypes.

Thank you. Please ask me if you have any doubt.


Related Solutions

Using SQL create a new database called school_app. Create a student table with fields id (auto...
Using SQL create a new database called school_app. Create a student table with fields id (auto increment), first_name, last_name. Create a course table with fields id (auto increment), course code (such as ITC or MTH), and course number (such as 100 or 295). Note that the relationship between student and course is many-to-many (n:m). Create a join table called student_course that implements the n:m relationship with fields id (auto increment), student_id, course_id, and grade (which has values 0, 1, 2,...
How to write a query in SQL using the Group by function to decide if the...
How to write a query in SQL using the Group by function to decide if the results of the diet worked. There are 6 columns ID, Gender, treatment, start_weight_kg, end_weight_kg, and correct change (end weight minus start weight). With the information given write a SQL to determine if the the results(correct change) worked. Question is not incomplete.
From the following mySql query create a function that returns a nth value of a table:...
From the following mySql query create a function that returns a nth value of a table: SELECT name, (SUM(price * quantity)) AS TotalPrice FROM Items NATURAL JOIN Inventory GROUP BY name ORDER BY (TotalPrice) DESC LIMIT 1, OFFSET 1; Shema: Inventory(name: String,item:String,quantity:integer) Items(item: String, brand: String, price:double)
JavaScript each item must have at least three categorical attributes and at least one numeric attribute....
JavaScript each item must have at least three categorical attributes and at least one numeric attribute. Write a function that counts the number of values each item attribute has. This is effectively a group-by on the item table for each column. For example: if the first attribute is colour, and its values are [ ‘red’, ‘black’, ‘white’, ‘black’, ‘red’ ], the counts for colour would be: red 2 black 2 white 1
In sql: Write a query to produce a listing of unique vendor names who have at...
In sql: Write a query to produce a listing of unique vendor names who have at least one invoice with us. You are using a table view called COMPANY_INFORMATION that lists a vendor id, vendor name, term id, and term description. The second table you will reference is the invoice table that lists vendor id, invoice num, invoice number, and invoice total. Do not show duplicate results.
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table as...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table as if it were being added to MySQL (please give explanations for each line of SQL code and a copy of the code as it would be entered into the query by itself: Customer PK Customer ID Text Phone Number int name text address ID int email text FK vendor ID int Vendor is the name of the table the FK comes from.
Using Triggers (5 pts.) Execute the following SQL to create the customer_audit table in the premier...
Using Triggers (5 pts.) Execute the following SQL to create the customer_audit table in the premier schema. CREATE TABLE IF NOT EXISTS customer_audit ( customer_num CHAR(3) NOT NULL,   customer_name VARCHAR(35) NOT NULL, street VARCHAR(15), city VARCHAR(15), state CHAR(2), zip CHAR(5), credit_limit DECIMAL(8,2), date_changed DATETIME NOT NULL, changed_by VARCHAR(45) NOT NULL); Notice that the audit table does not have a primary key defined. Explain why this might be acceptable. Based on the current attributes in the customer_audit table, suggest a possible...
Use a single SQL statement to create a relational table and to load into the table...
Use a single SQL statement to create a relational table and to load into the table department name, subject code, year of running and session of running that offered by the departments. Note that a running subject offered by a department means a lecturer of the department has been assigned to teach the subject. Next, enforce the appropriate consistency constraints on the new table.    When ready use SELECT statement to list the contents of the relational table created and...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer PK Customer ID Text Phone Number int name text address ID int email text FK vendor ID int Vendor is the name of the table the FK comes from.
Create a query in Access that uses two tables, the Patient table and the Session table. Add
Create a query in Access that uses two tables, the Patient table and the Session table. Add the LastName, FirstName, and SessionDate fields to the query grid. Run the query. How many records are displayed? Delete the join line between the field lists in Query Design View. Rerun the query. How many records are now displayed? Why are the results different? You do not need to save the queries. 
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT