Skip to content
Snippets Groups Projects
Commit 00287095 authored by rs11g21's avatar rs11g21
Browse files

Created a sample table with keys and able to insert data into the table

parent fa553007
No related branches found
No related tags found
No related merge requests found
#! /usr/bin/bash
$(/opt/lampp/bin/mysql -u root -e "create database cryptoTracker; use cryptoTracker")
#To store different types of crypto
$(/opt/lampp/bin/mysql -u root -e "use cryptoTracker; create table crypto (cryptoId int PRIMARY KEY, name varchar(20))")
$(/opt/lampp/bin/mysql -u root -e "use cryptoTracker; insert into crypto values (1,'Bitcoin')")
#To store the crypto price (value)
$(/opt/lampp/bin/mysql -u root -e "use cryptoTracker;
create table cryptoPrice (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)")
$(/opt/lampp/bin/mysql -u root -e "use cryptoTracker;
insert into cryptoPrice(cryptoID,value,collected) values (1,29.93,'2022-03-03 12:00:00')")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment