Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- JOHN MICHAEL GONZALES
- -- BSIT CUBAO2
- -- #2 ACTIVITY MYSQL
- -- DECIMAL INTO WHOLE NUMBER
- -- Create the database
- CREATE DATABASE nba_decimal;
- -- Switch to the created database
- USE nba_decimal;
- -- Create the table
- CREATE TABLE nuggets (
- player_number INT,
- player_name VARCHAR(50),
- rebounds DECIMAL(10, 2),
- assists DECIMAL(10, 2),
- points DECIMAL(10, 2)
- );
- -- Insert player data into the table
- INSERT INTO nuggets (player_number, player_name, rebounds, assists, points)
- VALUES
- (1, 'X', 0.00, 0.00, 0.00),
- (2, 'X', 0.00, 0.00, 0.00),
- (3, 'X', 0.00, 0.00, 0.00),
- (4, 'X', 0.00, 0.00, 0.00),
- (5, 'X', 0.00, 0.00, 0.00);
- -- Display the table with both decimal and converted whole number points
- SELECT player_name,
- rebounds, CAST(rebounds AS UNSIGNED) AS Conveted_Rebounds,
- assists, CAST(assists AS UNSIGNED) AS Conveted_Assists,
- points, CAST(points AS UNSIGNED) AS Conveted_Points
- FROM nuggets;
Advertisement
Add Comment
Please, Sign In to add comment