Mysql Build table and query

Source: Internet
Author: User

--ID: The only indication of the news
--Tiltle: Headline of the News
Content: The contents of the news
--Created_at: Time to add news
--types: The type of news
--Image: The thumbnail of the news
--Author: author
--View_count: View Volume
--Is_valid: Delete tag
CREATE TABLE ' News ' (
' ID ' INT not NULL auto_increment,
' Title ' VARCHAR ($) Not NULL,
' Content ' VARCHAR (a) is not NULL,
' Types ' VARCHAR () not NULL,
' Image ' VARCHAR () NULL,
' Author ' VARCHAR () NULL,
' View_count ' INT DEFAULT 0,
' Created_at ' DATETIME NULL,
' Is_valid ' SMALLINT DEFAULT 1,
PRIMARY KEY (' id ')
)

INSERT into News VALUES
(1, ' Thousands of different minds are connected ', ' Born of the Sea, proud of the sea. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(2, ' CCDI two times named Sun Zhengcai: Remove "disease tree" guardian "Forest" ', ' "sword out of the sheath, the more sharp edge-the 18 session of the central review of deepening the development of the summary" in the article mentioned: August 30, 18 session of the 12th round of inspection and rectification of the situation all to the public, During the first term of the party's history, the entire coverage of the central tour was fulfilled and the perfect ending. Mr. Sun, provincial, Wang Min, Huang Xingguo, such as a number of leading cadres in the patrol, "disease tree" was promptly removed, guarding the entire "forest" of the leafy. ‘,
' News ', ', ' Changan Street Know ', ' 1130 ', Now (), 1),
(3, ' Beijing's mayor: to ensure that this year's house prices do not grow ', ' because of the sea, born to the sea and proud. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(4, ' Hong Kong posted cold-blooded slogan suspects were exposed ', ' because of the sea, born to the sea and proud. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(5, ' he is the closest foreigner to Kim Jong-un ', ' Born of the Sea, proud of the sea. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(6, ' statistical bureau: August CPI Rose 1.8% ', ' because of the sea, and proud of the sea. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(7, ' The Zhang Ying suspect could not afford to pay the lawyer to quit ', ' because of the sea, and proud of the sea. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(8, ' The woman's hand-down is framed: do good deeds, ' because of the sea, and proud of the sea. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(9, ' men lose 30 million fled 13 and become rich ', ' because of the sea and Born to the sea and proud. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(10, ' thousands of different minds are connected ', ' Born of the Sea, proud of the sea. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ' ', ' on line Line 1 ', ' 1636 ', now (), ' 1 '),
(11, ' Thousands of different minds are connected ', ' Born of the Sea, proud of the sea. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(12, ' thousands of different minds are connected ', ' Born of the Sea, proud of the sea. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(13, ' Thousands of different minds are connected ', ' Born of the Sea, proud of the sea. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(14, ' Courier drink customers love soup after adding urine, ' because of the sea, born to the sea and proud. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1),
(15, ' Courier drink customers love soup after adding urine, ' because of the sea, born to the sea and proud. The world eyes focus on the charm Ludao, the BRICS cooperation freeze time in Xiamen. As the strategic fulcrum of the Maritime Silk Road, Xiamen successfully hosted the Nineth meeting of BRICS leaders, and China's wisdom and charm once again brought warmth and strength to the world.
' News ', ', ' on line Line 1 ', ' 1636 ', Now (), 1)
;

--delete the record with ID 15
DELETE from news where id=15


--Sort the ID in reverse order
SELECT *
From news
ORDER by ID DESC;

--Query The second page of data, each page has 5 records
SELECT *
From news
ORDER by ID DESC
LIMIT 5, 10;

Mysql Build table and query

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.