mysql 如何SELECT除了某个字段的所有字段

select
concat(‘select ‘,group_concat(case when column_name=‘field1’ then null else column_name end),’ from tablename;’)
from information_schema.columns where table_schema=’DBname‘ and table_name=’tablename‘;

得到的记录是语句如下

select field2,field3,field4,field5,field6,field7,field8,field9,field10  from tablename;

即把field1去掉了

同时增加如下知识点:

类别一、 如果两张张表(导出表和目标表)的字段一致,并且希望插入全部数据,可以用这种方法:

INSERT INTO 目标表 SELECT * FROM 来源表 ;

例如,要将 articles 表插入到 newArticles 表中,则可以通过如下SQL语句实现:

INSERT INTO newArticles SELECT * FROM articles ;

类别二、 如果只希望导入指定字段,可以用这种方法:

INSERT INTO 目标表 (字段1, 字段2, …) SELECT 字段1, 字段2, … FROM 来源表 ;
请注意以上两表的字段必须一致,否则会出现数据转换错误。

10 thoughts on “mysql 如何SELECT除了某个字段的所有字段

  1. Dear Sir,

    Let me start by introducing myself. I am the President of the expert consulting center ECC «Invest-Project» Ltd. (Moscow). It is a government owned company in charge of major projects in Russia.

    For the period of 5 years, the company has made the sum of 17.5 billion US dollar from oil and gas royalties, which is for the government of my country. We also received lease bonus payment of 3.8 billion US dollars during the third quarter of last year.

    Meanwhile, I have a new assignment with the government of my country and I will need your co-operation for a business Partnership. I will like you to incorporate a new company in Russia, so that I can use my position to award big contracts to you from my current company, which will give us Hundreds of Millions of Dollars as profit.

    Please, let me know if I can confide in you on this issue, so that we can agree on terms and conditions. Kindly bear with me if my English is not accurate enough, it is because I am using translator to translate my mail. Kindly reply to my private email address as soon as possible. Email: h66701824@gmail.com

    Sincerely yours,
    Andrei Ivanovich Lumpov,
    President of the expert consulting center ECC.
    “Invest-Project” Ltd. (Moscow).
    Email: h66701824@gmail.com

  2. Hi, logofun.ga

    I’ve been visiting your website a few times and decided to give you some positive feedback because I find it very useful. Well done.

    I was wondering if you as someone with experience of creating a useful website could help me out with my new site by giving some feedback about what I could improve?

    You can find my site by searching for “casino gorilla” in Google (it’s the gorilla themed online casino comparison).

    I would appreciate if you could check it out quickly and tell me what you think.

    casinogorilla.com

    Thank you for help and I wish you a great week!

  3. 25 charging traumatic pistols shooting automatic fire! Modified Makarov pistols with a silencer! Combat Glock 17 original or with a silencer! And many other types of firearms without a license, without documents, without problems!
    Detailed video reviews of our products you can see on our website.
    http://Gunrussia.pw
    If the site is unavailable or blocked, email us at – Gunrussia@secmail.pro or Gunrussia@elude.in
    And we will send you the address of the backup site!

  4. Are you an individual businessman or a business organization that wants to expand in business but has problem with funding?
    Intermediaries/Consultants/Brokers are welcome to bring their clients and are 100% protected. In complete confidence, we will work together for the benefits of all parties involved.
    Contact us on this email: razulizabiti@consultant.com
    Regards,
    Razul Izabiti

  5. Hi! logofun.ga

    We propose

    Sending your business proposition through the feedback form which can be found on the sites in the Communication partition. Feedback forms are filled in by our application and the captcha is solved. The profit of this method is that messages sent through feedback forms are whitelisted. This method raise the probability that your message will be read.

    Our database contains more than 25 million sites around the world to which we can send your message.

    The cost of one million messages 49 USD

    FREE TEST mailing of 50,000 messages to any country of your choice.

    This message is automatically generated to use our contacts for communication.

    Contact us.
    Telegram – @FeedbackFormEU
    Skype FeedbackForm2019
    WhatsApp – +44 7598 509161
    Email – FeedbackForm@make-success.com

  6. Ads54 is an innovative solution by His Majesty Software Ltd; it is an online platform where business owners make their business known to the world. Ads54 places your business on 54 different social media platforms including Facebook, Twitter, Instagram, LinkedIn, Whatsapp, Google etc How is this so? We have more than 50,000 promoters sharing Ads on various social media; more than 20,000 publishers placing your Ads on their websites and blogs. Thus with an army of over seventy thousand promoters and publishers, we create trends and flood the cyber space with your brand and help you reach as many people as you wish even up to one million people per day. Ads54 uses specific social media outlets to build relationships and tell your story. Visit: https://www.ads54.com

发表评论

电子邮件地址不会被公开。 必填项已用*标注